Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!bcm!dimacs.rutgers.edu!seismo!uunet!olivea!tymix!cirrusl!sunstorm!dhesi From: dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) Newsgroups: comp.lang.c Subject: Re: Here's a challenge for floating point lovers. Message-ID: <2965@cirrusl.UUCP> Date: 21 Feb 91 22:23:42 GMT References: <14964@smoke.brl.mil> <101@tdatirv.UUCP> <2855@charon.cwi.nl> <14993@smoke.brl.mil> <3322@unisoft.UUCP> <1991Jan29.173341.11899@zoo.toronto.edu> <1700@bbxsda.UUCP> <2929@cirrusl.UUCP> <265@nazgul.UUCP> Sender: news@cirrusl.UUCP Organization: Cirrus Logic Inc. Lines: 19 In <265@nazgul.UUCP> bright@nazgul.UUCP (Walter Bright) writes: >Think about a bank calculating interest on all its 5.25% checking >accounts. A penny here, a penny there, after many thousands of transactions >this adds up to real money. There has been more than one bank fraud where >a programmer stole money by having partial pennies credited to his personal >account... There are two issues here. One is the type of rounding, i.e., whether it's always up, always down, 5/4 rounding, or even/odd rounding. (The last is best if you want to avoid a net bias.) The other issue is that of precision. You can use even/odd rounding without necessarily doing all calculations in base 10. -- Rahul Dhesi UUCP: oliveb!cirrusl!dhesi