Against PEP 240
aahz at panix.com
Sun Jun 3 03:56:47 CEST 2001
In article <mailman.991515668.4621.python-list at python.org>,
Tim Peters <tim.one at home.com> wrote:
>> This said, what is the right way to deal with>currencies in Python
>> right now?
>> Tim Peters's FixedPoint.py:
>> 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.
Right. I was assuming because of the plural that Roman was likely to
want to do currency conversions, which involves multiplication at the
--- Aahz <*> (Copyright 2001 by aahz at pobox.com)
Androgynous poly kinky vanilla queer het Pythonista http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6
I surf faster than you do, monkey boy. (My take on Netscape vs. Lynx)
More information about the Python-list