Yves said:
I sometime import data from Excel, Dbase, Ascii files into Access, and
sometime 14.7 shows as
14.70000003468
Can someone explain where the 3468 comes from, they sure are not in the
incoming file.
Recall how floating point numbers are stored in computers.
There's an exponent and a mantissa. The mantisa is made up
of powers of 2. I don't recall exactly what the standard format
is, but suppose that it is to put the decimal at the start.
So, 14.7 is represented as 100 * 0.147, and then the 0.147
is represented as a fraction, as near as the floating binary
rep can do it.
So, 0.147 is less than 1/2, so the first bit is 0.
0.147 is less than 1/4, so the second bit is 0.
0.147 is greater than 1/8, so the third bit is 1, leaving 0.022.
0.022 is less than 1/16, so the fourth bit is 0.
0.022 is less than 1/32, so the fifth bit is 0.
0.022 is greater than 1/64, so the sixth bit is 1, leaving
0.006375
And so on. A typical 32-bit floating point number will have about
24 bits for mantissa, 7 for exponent, and one for sign. In that case,
the closest two floating point numbers could be to eachother, and
still be different, is 1 / 2^24, or 5.98E-8. So, if two numbers are
different by 6 in the 8th digit, they are not really different in the
computer. Make sense?
Socks