prePEP: Money data type

Alex Martelli aleax at aleax.it
Sat Oct 18 14:11:22 EDT 2003


Paul Rubin wrote:

> Alex Martelli <aleax at aleax.it> writes:
>> > 1. I've seen lots of strange rounding policies in various nooks
>> > and crannies. Is there any way of specifying a rounding policy
>> > that would be used and inherited by the result money object?
>> 
>> Amen, Hallelujah.  I've followed up to Batista's similar post to
>> python-dev by pointing out chapter and verse of EU regulations that
>> _mandate_ "rounding to nearest and always round exactly-halfway
>> UPWARDS", for example.
> 
> Are you serious about this?  I thought financial computations with
> decimal arithmetic had been done in Cobol since the 1950's.  They

They have (at least since the early '60s -- not sure when Cobol
was first released) but the accountants have not necessarily been
happy with their treatment of cents.

> haven't gotten this stuff figured out by now?  Can you crunch some
> calculation through a Cobol program and get an answer thtat's correct
> in the US and wrong in the EU?

Definitely, given that the US and EU have different laws: if your
program gives the same answers in both places, cases can surely be
found where the answer is wrong (and at least in the EU case illegal;
I don't know if the matter is regulated by law in the US) in at
least one of the two places.

Until and unless somebody bangs EU and US legislators' heads
together, and forces them to agree on one common standard for
accounting (down to such details as how to round half cents),
I don't see what programmers, as such, can do about it -- except
keep their software customizable in such variant-by-jurisdiction
respects:-(.


Alex





More information about the Python-list mailing list