123.3 + 0.1 is 123.3999999999 ?

Fredrik Lundh fredrik at pythonware.com
Thu May 15 14:10:03 EDT 2003


Jeff Kowalczyk wrote:

> Has the python community converged on a favored
> solution for financial/currency apps? An uninformed use
> of floats as currency would have obvious pitfalls.
>
> I hope to write some order/inventory apps for a client
> who uses product unit prices with variations of as little
> the ten-thousandths of a cent, and unit counts of
> millions of items.
>
> It would be reassuring to have the necessary float()
> issues for fixed-accuracy calculation encapsulated
> in a reusable class. Does a decent one already exist?

if Aahz didn't spend all his time arguing about object semantics,
he might get around to finish his Decimal.py module:

    http://starship.python.net/crew/aahz/Decimal.py

which is based on Mike Cowlishaw (of REXX fame)'s work over at:

    http://www2.hursley.ibm.com/decimal/

there's also:

    http://fixedpoint.sourceforge.net/

and probably others that I cannot think of right now.

</F>








More information about the Python-list mailing list