Against PEP 240

Tim Peters at
Sat Jun 2 17:00:09 EDT 2001

[Roman Suzi]
> This said, what is the right way to deal with>currencies in Python
> right now?

> Tim Peters's
> You *probably* want to set the precision to three or four places
> so that rounding errors don't propagate.

Hmm.  It's important to note that + and - on FixedPoints never suffer
rounding errors.  Add up, say, a million dollars-and-cents FixedPoint
quantities each of precision 2, and the computed result is *exactly*
correct.  The problems with using binary f.p. in "the naive" way for
financial calcuations only start with that most dollars-and-cents inputs
can't be represented exactly; subsequent additions are also subject to
rounding errors; FixedPoint suffers neither problem.

More information about the Python-list mailing list