Xref: utzoo comp.lang.misc:3518 comp.arch:11517
Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!ico!ism780c!news
From: news@ism780c.isc.com (News system)
Newsgroups: comp.lang.misc,comp.arch
Subject: Re: Fast conversions, another urban myth?
Message-ID: <33812@ism780c.isc.com>
Date: 25 Sep 89 20:59:55 GMT
References: <832@dms.UUCP> <688@UALTAVM.BITNET> <136@bbxsda.UUCP> <4125@cbnewsh.ATT.COM>
Reply-To: marv@ism780.UUCP (Marvin Rubenstein)
Organization: Interactive Systems Corp., Santa Monica CA
Lines: 18

In article <4125@cbnewsh.ATT.COM> beyer@cbnewsh.ATT.COM (jean-david.beyer) writes:
>I have never done business-oriented calculations, but  it seems to me,
>as an outsider, that calculating everything in pennies solves the round-off
>problems (but perhaps no others), doesn't it?

That scheme works until one includes divide as an operation or until one
needs to convert from pennies to Yen.  The problem does not depend on the
base in which arithmetic is done.  The problem is due to the fact that, in
general, a rational number cannot be represented as a radix fraction.  The
only way to avoid round off error (with divides) is to do rational
arithmetic.  Thus 1 divided by 3 is represented by the couple (1,3) and round
off error does not occur.  But even this fails if one is required to compute
the area of the penny given its diameter.  Pi is not a rational number.

Moral: There is no way to avoid round off error.  So we have to learn to
live with it.

     Marv Rubinstein