On 2004-07-11 at 19:06:32 Dmitry Morozovsky wrote: > 1.000000 1.000 0 > 2.000000 2.000 1 > 3.000000 3.000 2 > 4.000000 4.000 3 > 5.000000 5.000 5 > 6.000000 6.000 6 > 7.000000 7.000 7 > 8.000000 8.000 7 > 9.000000 9.000 8 > 9.999999 10.000 9
Yes, this is completely normal if you use IEEE floating point, due to decimal <-> binary conversion and other accumulating rounding errors. In other words, floating point calculations will almost never be exact... This is not a gcc problem. In fact, I can even reproduce your output under Windows using a Microsoft C compiler! :)
pgpniUit3rNUP.pgp
Description: PGP signature