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

Christian Tismer tismer at tismer.com
Wed Oct 2 04:45:24 CEST 2002


Paul Rubin wrote:
> "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"?

Well, you can guess what's right:
What do you think is the definition of a business arithmetic?
Having no or minimum possible errors. And if, then positive
to my account, please. :)
All cases probably means every number inserted into the
above formula which can occour in business. This is finite.

>>Like I said, decimal arithmetic is STILL the only choice.
> 
> 
> I'm not convinced decimal arithmetic is "right in all cases".

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.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/






More information about the Python-list mailing list