[comp.lang.misc] Floating Point Decimal

shapiro@rb-dc1.UUCP (Mike Shapiro) (05/20/89)

In article <10499@ihlpb.ATT.COM> res@ihlpb.ATT.COM (Rich Strebendt) writes:
>In article <832@cbnewsc.ATT.COM>, nevin1@cbnewsc.ATT.COM (nevin.j.liber) writes:
>| In article <960018@hpclskh.HP.COM| skh@hpclskh.HP.COM (The Polar Bear) writes:
... much about floating point, decimal, packed decimal, etc.
inefficiencies for handling currency values.

From time to time, solutions have been proposed and occasionally
implemented.

Remember that decimal arithmetic means using decimal calculation,
truncation, and rounding rules, not necessarily decimal
representation.  An alternate representation I played with a bit in
the 1970s was a base-1000 representation system, storing three decimal
digits in a ten-bit unit, using binary representation with excess-12
encoding so that 1's complement was also 9's complement, for handling
negative numbers.  An integer number could use as many 10-bit units as
necessary, while a floating point number used this form of integer,
along with either a similar or standard binary value.  Normalization
would be non-zero in the highest triple or digit position.  This works
reasonably well in a tagged architecture environment.  Of course since
it is so non-standard it can't easily fit into commercial machines now
on the market.

I seem to remember some correspondence with someone at IBM Watson lab
who was working on related ideas, but had no more luck in selling them
than I did (that I know).

I also recall an interpretation of the COBOL-74 expression evaluation
rules which required the use of 18-digit floating-point decimal
algorithms.  Does anyone know what has become of this.  (I haven't
followed the language since I got out of the COBOL compiler business.)

The answer, then, shouldn't be which language we are using or which
existing data type best fits the application, but rather what data
representation and computational algorithms should we use for an
application, even if we must invent new ones.

-- 
Michael Shapiro, Encore Computer Corporation (formerly Gould/GSD)
15378 Avenue of Science, San Diego, CA 92128
(619)485-0910    UUCP: shapiro@rb-dc1