[lex.fcon] (original) (raw)
5 Lexical conventions [lex]
5.13 Literals [lex.literal]
5.13.4 Floating-point literals [lex.fcon]
floating-point-suffix: one of
f l F L
The type of a floating-point-literal is determined by its floating-point-suffix as specified in Table 10.
In the significand, the sequence of digits or hexadecimal-digit_s_and optional period are interpreted as a base N real number s, where N is 10 for a decimal-floating-point-literal and 16 for a hexadecimal-floating-point-literal.
[Note 1:
Any optional separating single quotes are ignored when determining the value.
— _end note_]
If an exponent-part or binary-exponent-partis present, the exponent e of the floating-point-literalis the result of interpreting the sequence of an optional sign and the digit_s_as a base 10 integer.
Otherwise, the exponent e is 0.
The scaled value of the literal is for a decimal-floating-point-literal and for a hexadecimal-floating-point-literal.
[Example 1:
The floating-point-literals 49.625 and 0xC.68p+2 have the same value.
The floating-point-literals 1.602'176'565e-19 and 1.602176565e-19have the same value.
— _end example_]
If the scaled value is not in the range of representable values for its type, the program is ill-formed.
Otherwise, the value of a floating-point-literalis the scaled value if representable, else the larger or smaller representable value nearest the scaled value, chosen in an implementation-defined manner.