Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!sdd.hp.com!usc!chaph.usc.edu!usc.edu!news From: news@usc.edu Newsgroups: comp.lang.c Subject: Re: Floating point exactness & alternatives (summary) Message-ID: <11503@chaph.usc.edu> Date: 18 Aug 90 18:09:23 GMT References: <713@tetrauk.UUCP> <1990Aug7.173030.2823@zoo.toronto.edu> <168@srchtec.UUCP> Sender: news@chaph.usc.edu Followup-To: comp.lang.c Organization: University of Southern California, Los Angeles, CA Lines: 40 Nntp-Posting-Host: aludra.usc.edu In-reply-to: johnb@srchtec.UUCP's message of 8 Aug 90 22:36:39 GMT Originator: news@aludra.usc.edu In article <168@srchtec.UUCP> johnb@srchtec.UUCP (John Baldwin) writes: In article <1990Aug7.173030.2823@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes: >In article <713@tetrauk.UUCP> rick@tetrauk.UUCP (Rick Jones) >writes: >> Auditors have this annoying view that accounts must balance to >> the penny, not 1 part in 10 to-the-something. There is a good >> case for using some form of BCD representation, but there are >> many programming advantages in using the embedded numerical >> types of the language... > >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. This is very true. Units of money should never be stored as fractions. BCD is merely one technique of ensuring this. 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. (Does anybody know just HOW frequently the exchange rates change?) This would require an INTERNAL currency which would probably NOT be the same as a recognized world currency; one in which any unit of any other world currency can be expressed as an integer. This is probably tricky enough to find WITHOUT having the conversions changing on you all the time! The only solution I know of to the multiple currency problem is to keep records in the same form as the real world entities they represent. If you have two apples and three oranges, and the exchange rate is currently 1 apple = 1 orange, that does not mean you have 5 apples nor does it mean you have 5 oranges. The exchange rate only exists when there is an exchange, and is only set for that exchange. (Not to be confused with a transaction, which might consiste of many exchanges.) wulkwa