Floating point bug?

Preston Landers planders at journyx.com
Wed Feb 13 19:34:56 EST 2008


marek.rocki at wp.pl(marek.rocki at wp.pl)@2008.02.13 15:13:20 -0800:
> Not a bug. All languages implementing floating point numbers have the
> same issue. Some just decide to hide it from you. Please read
> http://docs.python.org/tut/node16.html and particularly
> http://docs.python.org/tut/node16.html#SECTION0016100000000000000000
>


This is true.  Fortunately Python does provide a module which allows
you to work with exact floating point quantities.

http://docs.python.org/lib/module-decimal.html

Of course the downside is that these are not quite as fast as the
built in float type, but probably good enough for most purposes.

Preston




More information about the Python-list mailing list