The description for type float
in C mentions that the number of significant digits is 6
. However,
float f = 12345.6;
and then printing it using printf() does not print 12345.6
, it prints 12345.599609
. So what does "6 significant digits" (or "15 in case of a double
") mean for a floating point type?
6 significant digits means that the maximum error is approximately +/- 0.0001%. The single float value actually has about 7.2 digits of precision (source). This means that the error is about +/- 12345.6/10^7 = 0.00123456. Which is on the order of your error (0.000391).