Decimal arithmetic, was Re: Python GUI app to impress the boss?

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Tue Oct 1 23:11:48 EDT 2002


----- Original Message ----- 
From: "Christian Tismer" <tismer at tismer.com>

> It has a better chance to be right (meaning exact) since its
> number base is identical to the money number base.
> Having more prime factors than (2, 5) in it would lead to
> even more fractions being exact, but I doubt that is not
> what they want. They want the computer think exactly as
> wrong as they do.

Huh.  You managed to back me up and bust my chops at the
same time.

What, exactly, is wrong with wanting math involving
essentially decimal monetary amounts to lead to proper
decimal rounding?  Paul keeps waving bananas in my face.
That's not the problem... since time immemorial, grocers
have had to handle three-for-a-buck sales.  They know
how they want the math done; and adding some extra 
precision to the intermediate steps solves Paul's
complaint.  So why does he keep complaining?

I have read several posts asserting that "we" don't know
or can't explain properly how we want things rounded or
computed.  What's so hard to follow here?  Didn't you all
learn decimal arithmetic in grade school (or local 
equivalent)?  I'd like to know what the problem is here.

My only complaint is that the fixedpoint.py module does
only banker's rounding.  Bah.  I do have bank customers,
but they don't let me handle their math (it's done in
true, old-fashioned BCD as far as I can tell).  Most of
my business customers do the >= 0.5 up, < 0.5 down form
they learned in school... so what I need is a math library
that does it that way without losing or gaining
"unexpected" pennies along the way.

Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net





More information about the Python-list mailing list