Valid figures:
Floating-point number 7 significant digits.
Double precision number 16 significant digits.
The representation of floating-point numbers in C/C++ follows the IEEE 754 standard.
Floating-point number consists of three parts: sign bit S, exponent part E (sequence code) and mantissa part M (as follows).
floating
S - E - M
1 bit -8 -23
double;twofold
S - E - M
1 bit-1 1 bit -52
The conversion formula of decimal number is (n m represents the m power of n, and b represents the previous binary number):
2^(E- 127) * ( 1。 M)B
The precision of floating-point numbers depends on the mantissa part. The more digits in the mantissa part, the more significant digits can be represented.
The mantissa of a single-precision number is stored as 23 bits, plus the default 1 bit 1 2 (23+1) =16777216 before the decimal point. Because 10 7
The mantissa with double precision is stored in 52 bits, 2 (52+1) = 90071992 54740992,10/6.