123.3 + 0.1 is 123.3999999999 ?

Isaac To kkto at csis.hku.hk
Thu May 15 21:48:28 EDT 2003


>>>>> "Jeff" == Jeff Kowalczyk <jtk at yahoo.com> writes:

    >> The Python tutorial has the full story:
    >> http://www.python.org/doc/current/tut/node14.html

    Jeff> Has the python community converged on a favored solution for
    Jeff> financial/currency apps? An uninformed use of floats as currency
    Jeff> would have obvious pitfalls.

    Jeff> I hope to write some order/inventory apps for a client who uses
    Jeff> product unit prices with variations of as little the
    Jeff> ten-thousandths of a cent, and unit counts of millions of items.

    Jeff> It would be reassuring to have the necessary float() issues for
    Jeff> fixed-accuracy calculation encapsulated in a reusable class. Does
    Jeff> a decent one already exist?

The type that you have mentioned is already there.  It is called long
integers.

Regards,
Isaac.




More information about the Python-list mailing list