Precision in C floats

“6 digits after the decimal point” is nonesnse, and your example is a good demonstration of this.

This is an exact specification of the float data type.

The precision of the float is 24 bits. There are 23 bits denoting the fraction after the binary point, plus there’s also an “implicit leading bit”, according to the online source. This gives 24 significant bits in total.

Hence in decimal digits this is approximately:

24 * log(2) / log(10) = 7.22

Leave a Comment