What is the floating constant in C?

The floating-point constant is a double-precision floating-point number represented by two numbers separated by an E.

The value of the constant is the product of the first number and the power of 10 specified by the second number.

Types of floating-point constants

  1. Float
  2. Double
  3. Long Double

Criteria

The floating-point constant adheres to the following criteria:

  1. Decimal integer

  2. Decimal point

  3. Decimal fraction

  4. e or E and a signed integer exponent (optional)

  5. Type suffix: f or F or l or L (optional). Example: 0.32f where f denotes float. Also, for example 0.32l, where l denotes long double.

There should be a decimal integer or a fraction – but not both – to qualify for a floating-point constant.

Use prefixed operator minus (-) for negative floating constants.

Constant must be within 24 characters long.

The first number should be within 17 digits, and the exponent must be within 3 digits.

Range

The floating-point constants range from (±2.2250 * 10^-308) to (±6.80564774407 * 10^38).

A user can make use of the l or L suffix, making the constant a long double type if the required number exceeds the given range.

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved