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

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Wed Oct 2 08:14:59 EDT 2002


----- Original Message ----- 
From: "Dennis Lee Bieber" <wlfraed at ix.netcom.com>


> Chris Gonnerman fed this fish to the penguins on Tuesday 01 October 
> 2002 08:11 pm:
> 
> > 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.
> >
>         Okay, and which way should it do  -0.5? Is that 
> rounded to 0.0 or -1.0?

I have to admit to being unclear on that point.  If I 
remember my business classes right, it's the absolute
value that matters; so for negative numbers, <= -0.5 down,
> -0.5 up.  But I'd most likely dig up a business math
textbook and check before casting it in code.

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





More information about the Python-list mailing list