Decimal() instead of float?

Hendrik van Rooyen mail at
Thu Nov 16 06:40:12 CET 2006

"Fredrik Lundh" <fredrik at> wrote:

> ......  and seriously, under-
> standing the various aspects of floats and decimals is utterly trivial 
> compared to all the nearly-magical things you need to understand to be 
> able to do geographical calculations at a sub-millimeter scale.  heck, 
> even sub-kilometer stuff is pretty hard to get right ;-)

This is true - have you looked at that thing they call a geode? - horrible...

I can never understand why people grab for floats at the first opportunity.
To my simple mind, it seems better to work with a sub unit, and to stick to
integer arithmetic - if, as Steve said, there is a speed penalty for changing 
from floats to decimal. then you can make even a cripple processor look 
good by sticking to integers - unless you run out of precision...

- Hendrik

More information about the Python-list mailing list