Floating point errors?

Erik Max Francis max at alcyone.com
Thu May 10 10:59:18 EDT 2001


Ben Allfree wrote:

> int( (2.3 - 2) * 1000 ) = 299
> int( .3 * 1000 ) = 300
> 
> What am I missing? The first one seems too simple to expect a rounding
> error :)

Floating point values are not exact.

>>> 2.3 - 2.0
0.29999999999999982

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ Bachelors have consciences, married men have wives.
\__/ H.L. Mencken
    REALpolitik / http://www.realpolitik.com/
 Get your own customized newsfeed online in realtime ... for free!



More information about the Python-list mailing list