Accountants, Finance, Language

Kurt Guntheroth kurt at fluke.UUCP
Thu Nov 22 03:09:29 AEST 1984

This bogus BCD thing crops up again and again.  It poisoned the ANSI BASIC
standard too.  Won't you guys examine the NEEDS of financial people?

Financial people want dollars and cents calculations that come out exact.
The first thing that seems to come into people's minds when they hear ths is
BCD floating point.  BCD floating point is wasteful and slow and is probably
not the best answer.  Floating point will represent numbers that are both
larger and smaller than financial people need, and doing exact calculations
in floating point can lead to problems in roundoff, truncation, and so
forth, even if the number is kept in BCD.

What financial people 'need' is a fixed point representation.  Fixed point
numbers are like integers, only you get shifting of the product in a
multiplication or the quotient in a division to make the decimal point line
up in the right bit position.  You get EXACT results, and an out-of-range
number causes a very conventional integer over/underflow.  Fixed point
numbers can be manipulated in binary so they are optimally fast and densely
encoded.  Any architecture which handles integers can handle them.

Now, will all the financial people on usenet who use C for their programming
please raise their hand?  Hmmmm.  That's what I thought, not enough to make
the effort of adding a new data type worth the trouble.  Now can we get on
to something else?
Kurt Guntheroth
John Fluke Mfg. Co., Inc.

More information about the Comp.lang.c mailing list