5 Lexical conventions [lex]

5.13 Literals [lex.literal]

5.13.4 Floating-point literals [lex.fcon]

	fractional-constant exponent-part floating-point-suffix
	digit-sequence exponent-part floating-point-suffix
	hexadecimal-prefix hexadecimal-fractional-constant binary-exponent-part floating-point-suffix
	hexadecimal-prefix hexadecimal-digit-sequence binary-exponent-part floating-point-suffix
	digit-sequence . digit-sequence
	digit-sequence .
	hexadecimal-digit-sequence . hexadecimal-digit-sequence
	hexadecimal-digit-sequence .
	e sign digit-sequence
	E sign digit-sequence
	p sign digit-sequence
	P sign digit-sequence
sign: one of
	+  -
	digit-sequence ' digit
floating-point-suffix: one of
	f  l  F  L
A floating-point 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-point literal is a decimal floating-point 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.
The floating-point 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-point literal.
The radix point (but not the exponent) can be omitted from a hexadecimal floating-point literal.
The integer part, the optional radix point, and the optional fraction part, form the significand of the floating-point literal.
In a decimal floating-point literal, the exponent, if present, indicates the power of 10 by which the significand is to be scaled.
In a hexadecimal floating-point literal, the exponent indicates the power of 2 by which the significand is to be scaled.
The floating-point 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-point 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.