Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@zoo.toronto.edu (Henry Spencer)
Subject: Re: Floating point exactness & alternatives (summary)
Message-ID: <1990Aug9.154302.29976@zoo.toronto.edu>
Organization: U of Toronto Zoology
References: <713@tetrauk.UUCP> <1990Aug7.173030.2823@zoo.toronto.edu> <168@srchtec.UUCP>
Date: Thu, 9 Aug 90 15:43:02 GMT

In article <168@srchtec.UUCP> johnb@srchtec.UUCP (John Baldwin) writes:
>>Our own experience, in building accounting systems for our own use, is that
>>the problem can often be eliminated by ignoring the decimal point in dollar
>>currencies and thinking of money as measured in pennies.
>
>Doesn't this push him back into the "continued sums" implementation?
>Remember, conversion rates between different currencies "slide" up and down
>at a fairly high frequency...

If you are doing tricky things with exchange rates, all bets are off. :-)
In the simple case, though, if you go to Thomas Cook and buy (say) US$,
they will *not* give you a fraction of a cent even if the mathematical
conversion factor would indicate it.  They will round the amount to an
integer in some way (typically in their favor :-)).  So if you're trying
to keep track of that transaction by program, you don't need to keep the
mathematically-exact amount, which is wrong anyway; it is both sufficient
and correct to use the appropriate rounding function to give an integer,
and store that.
-- 
It is not possible to both understand  | Henry Spencer at U of Toronto Zoology
and appreciate Intel CPUs. -D.Wolfskill|  henry@zoo.toronto.edu   utzoo!henry
