Floating point errors?

John J. Lee phrxy at csv.warwick.ac.uk
Thu May 10 18:01:42 EDT 2001


On Thu, 10 May 2001, David Lees wrote:

> 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)

Rationality is a property of numbers, not their representation.  0.3 is a
rational number because you can represent it as a ratio of two integers,
which is as true in binary as it is in decimal.  I know what you mean,
though.


John




More information about the Python-list mailing list