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
- Float
- Double
- Long Double
Criteria
The floating-point constant adheres to the following criteria:
-
Decimal integer
-
Decimal point
-
Decimal fraction
-
eorEand a signed integer exponent (optional) -
Type suffix:
forForlorL(optional). Example:0.32fwherefdenotes float. Also, for example0.32l, whereldenotes 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
lorLsuffix, making the constant along doubletype if the required number exceeds the given range.
Free Resources