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

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Sun Sep 29 23:42:52 EDT 2002


----- Original Message ----- 
From: "Paul Rubin" <phr-n2002b at NOSPAMnightsong.com>


> "Chris Gonnerman" <chris.gonnerman at newcenturycomputers.net> writes:
> > > >>> (.70 * .05) + .000000001
> > > 
> > > rounds to the right thing.
> > 
> > Cool.  Now PROVE that's right in all cases.
> 
> What do you mean by "right"?  What do you mean by "all 
> cases"?

The original subject is *business* arithmetic.  There is no
choice but to use decimal arithmetic if you want your math
results to match good-old-fashioned pen and paper math.

That defines "right."  "All cases" refers to all numeric 
domains common to *business* math.  The exact number of
decimal places and the rounding rule (0.5 up/0.4 down vs. 
"banker's rounding" which is rounding 0.5 to an even number) 
will vary from nation to nation and sometimes from industry
to industry, but the expectation of reliable rounding results
is still the same.

Sorry not to have defined the terms; if you are following 
the discussion I would expect you to know this.  If we were
talking about tracking satellites or computing the mass of 
the electron I'd defer to the experts (those who work in
those fields) regarding the best sort of computer math to 
use.  When it comes to business, though, I have experience.

As another poster noted, it really doesn't matter if *we*
think that results such as the above are "good enough," as
our bosses/customers/legislators/users control the definition
of "good enough."

Most of them can't stand to mislay a penny.

I've never worked for a boss who wasn't human (although I
have wondered sometimes if I was working for a weasel in 
human clothing).

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





More information about the Python-list mailing list