123.3 + 0.1 is 123.3999999999 ?

Christopher A. Craig list-python at ccraig.org
Fri May 16 10:20:33 EDT 2003


Isaac To <kkto at csis.hku.hk> writes:

> But what if you divide the number by 3, multiply it by 3 again, and compare
> with 1?

Use rationals:
http://sf.net/projects/pythonic and look at cRat

If you compile it for Windows, please mail me a binary so I can add it
to the downloads page. <r(1)/100 wink>

-- 
Christopher A. Craig <list-python at ccraig.org>
Code that does not adhere to the documentation is bad code that should
be broken, even if it is your own. -- Christian Tismer





More information about the Python-list mailing list