callen@inmet (10/05/89)
/* Written 8:53 am Sep 22, 1989 by beyer@cbnewsh.UUCP in inmet:comp.arch */ /* ---------- "Re: Fast conversions, another urban" ---------- */ In article <136@bbxsda.UUCP>, scott@bbxsda.UUCP (Scott Amspoker) writes: > > If I may throw in my $.02 worth: Decimal arithmetic is alive and > well and not merely an artifact of old COBOL implementations. We > do everything in C and require decimal arithmetic because of the > business nature of our applications. It is a constant disappointment > when the scientific-oriented hardware industry forgets that some of > us need to have 100 pennies == 1 dollar. Interest calculations As a former scientific computer user, I hardly consider that the computer hardware industry is scientific-oriented. Shrinking wordsize from 36 bits to 32 bits, screwing up round-off algorithms for a long time, and so on. Begrudgingly adding floating-point operations to obviously business-oriented machines. I do not know who the machines are really designed for. (I recognize that some manufacturer may make machines suited to the needs of the user, but why do they seem to be the exceptions.) 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? -- Jean-David Beyer AT&T Bell Laboratories Holmdel, New Jersey, 07733 attunix!beyer /* End of text from inmet:comp.arch */
gary@dgcad.SV.DG.COM (Gary Bridgewater) (10/06/89)
In article <18000002@inmet> callen@inmet writes: > >/* Written 8:53 am Sep 22, 1989 by beyer@cbnewsh.UUCP in inmet:comp.arch */ >/* ---------- "Re: Fast conversions, another urban" ---------- */ >In article <136@bbxsda.UUCP>, scott@bbxsda.UUCP (Scott Amspoker) 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? This is the second posting to state this. Time to put on our thinking caps... Just because the current smallest denomination coin in general circulation is the penny - should that mean that commercial calculations are limited to that resolution? In fact it doesn't. The accuracy of a commercial calculation ( loan interest, savings interest, amortizations, etc.) is determined by some policy setting board with authority over that interest (IRS, FED, state banking commission). This is POLICY. Don't keep confusing Policy with 'seems to me' or 'what a real keen algorithm can do' or 'what a Big Mean computer can do'. If the policy says you keep 8 decimal places then that is what you do. What you want to do is compute using - wait for it - Float Decimal. Not Float Binary with a printf to fool the human into thinking you used decimal. With Float Decimal, if you divide 100 by 3 using 8 digits after the decimal point then you get 33.33333333. Two decimal digits to the left of the decimal point and eight after. You can now multiply by 3 and discover that you 'lost' .00000001 in the calculation. You will probably have to account for that later. That is why loan payments can be $100, $100, $100, $100.01. There is no such thing as round off error because you go back and fix the calculation to account for the error. (You don't usually see banks offering 8 1/3% interest, tho.) This isn't mathematics. It isn't scientific calculations. It's accounting. Bankers don't grok bits. -- Gary Bridgewater, Data General Corp., Sunnyvale Ca. gary@sv4.ceo.sv.dg.com or {amdahl,aeras,amdcad,mas1,matra3}!dgcad.SV.DG.COM!gary No good deed goes unpunished.
scott@bbxsda.UUCP (Scott Amspoker) (10/06/89)
In article <1155@svx.SV.DG.COM> gary@svx.SV.DG.COM () writes: >In article <18000002@inmet> callen@inmet writes: >>/* Written 8:53 am Sep 22, 1989 by beyer@cbnewsh.UUCP in inmet:comp.arch */ >>/* ---------- "Re: Fast conversions, another urban" ---------- */ >>In article <136@bbxsda.UUCP>, scott@bbxsda.UUCP (Scott Amspoker) 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? > >This is the second posting to state this... Actually this is a repeat of an earlier posting. It's rerun time, folks. Please, let's not start this thread up again so soon. >>[ good explanation deleted ] -- Scott Amspoker Basis International, Albuquerque, NM (505) 345-5232