Floating point errors?
David Lees
DavidL at nospammyraqia.com
Thu May 10 11:41:55 EDT 2001
Complexity has nothing to do with rounding. Try:
>>> 2.3-2.0
0.29999999999999982
Rounding is exactly the issue and this looks like the old classic
problem, namely rational numbers in one base (say 10) can be irrational
in another base (say 2)
david lees
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