Floating point errors?

Martin Franklin martin.franklin at westerngeco.com
Thu May 10 10:38:26 EDT 2001


try this:


>>> 2.3-2
0.29999999999999982
>>> .3
0.29999999999999999
>>>






Ben Allfree wrote:

> Using Python 2.1 on Win32:
>
> 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 :)






More information about the Python-list mailing list