5 Lexical conventions [lex]

5.13 Literals [lex.literal]

5.13.4 Floating literals [lex.fcon]

floating-literal:
	decimal-floating-literal
	hexadecimal-floating-literal
decimal-floating-literal:
	fractional-constant exponent-part floating-suffix
	digit-sequence exponent-part floating-suffix
hexadecimal-floating-literal:
	hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-suffix
	hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-suffix
fractional-constant:
	digit-sequence . digit-sequence
	digit-sequence .
hexadecimal-fractional-constant:
	hexadecimal-digit-sequence . hexadecimal-digit-sequence
	hexadecimal-digit-sequence .
exponent-part:
	e sign digit-sequence
	E sign digit-sequence
binary-exponent-part:
	p sign digit-sequence
	P sign digit-sequence
sign: one of
	+  -
digit-sequence:
	digit
	digit-sequence ' digit
floating-suffix: one of
	f  l  F  L
A floating literal consists of an optional prefix specifying a base, an integer part, a radix point, a fraction part, an e, E, p or P, an optionally signed integer exponent, and an optional type suffix.
The integer and fraction parts both consist of a sequence of decimal (base ten) digits if there is no prefix, or hexadecimal (base sixteen) digits if the prefix is 0x or 0X.
The floating literal is a decimal floating literal in the former case and a hexadecimal floating literal in the latter case.
Optional separating single quotes in a digit-sequence or hexadecimal-digit-sequence are ignored when determining its value.
[Example
:
The floating literals 1.602'176'565e-19 and 1.602176565e-19 have the same value.
end example
]
Either the integer part or the fraction part (not both) can be omitted.
Either the radix point or the letter e or E and the exponent (not both) can be omitted from a decimal floating literal.
The radix point (but not the exponent) can be omitted from a hexadecimal floating literal.
The integer part, the optional radix point, and the optional fraction part, form the significand of the floating literal.
In a decimal floating literal, the exponent, if present, indicates the power of 10 by which the significand is to be scaled.
In a hexadecimal floating literal, the exponent indicates the power of 2 by which the significand is to be scaled.
[Example
:
The floating literals 49.625 and 0xC.68p+2 have the same value.
end example
]
If the scaled value is in the range of representable values for its type, the result is the scaled value if representable, else the larger or smaller representable value nearest the scaled value, chosen in an implementation-defined manner.
The type of a floating literal is double unless explicitly specified by a suffix.
The suffixes f and F specify float, the suffixes l and L specify long double.
If the scaled value is not in the range of representable values for its type, the program is ill-formed.