floating point literal
Floating point literal defines a compiletime constant whose value is specified in the source file.
Contents 
[edit] Syntax
significand exponent(optional) suffix(optional)  
Where the significand has one of the following forms
digitsequence  (1)  
digitsequence .

(2)  
digitsequence(optional) . digitsequence

(3)  
0x  0X hexdigitsequence

(4)  (since C++17)  
0x  0X hexdigitsequence .

(5)  (since C++17)  
0x  0X hexdigitsequence(optional) . hexdigitsequence

(6)  (since C++17)  
The exponent has the form
e  E exponentsign(optional) digitsequence

(1)  
p  P exponentsign(optional) digitsequence

(2)  (since C++17)  
exponentsign, if present, is either +
or 
suffix, if present, is one of f
, F
, l
, or L
. The suffix determines the type of the floatingpoint literal:
 (no suffix) defines double

f F
defines float 
l L
defines long double
Optional single quotes(' ) can be inserted between the digits as a separator, they are ignored when compiling. 
(since C++14) 
[edit] Explanation
Decimal scientific notation is used, meaning that the value of the floatingpoint literal is the significand mutiplied by the number 10 raised to the power of exponent. The mathematical meaning of 123e4 is 123×10^{4}
If the significand begins with the character sequence For a hexadecimal floating constant, the significand is interpreted as a hexadecimal rational number, and the digitsequence of the exponent is interpreted as the integer power of 2 to which the significand has to be scaled. double d = 0x1.2p3; // hex fraction 1.2 (decimal 1.125) scaled by 2^3, that is 9.0 
(since C++17) 
[edit] Example
#include <iostream> int main() { std::cout << 123.456e67 << '\n' << .1E4f << '\n' << 58. << '\n' << 4e2 << '\n'; }
Output:
1.23456e65 1000 58 400
[edit] Notes
The hexadecimal floatingpoint literals were not part of C++ until C++17, although they can be parsed and printed by the I/O functions since C++11: both C++ I/O streams when std::hexfloat is enabled and the C I/O streams: std::printf, std::scanf, etc. See std::strtof for the format description
[edit] See also
C documentation for floating point constant
