C needs BCD...
Thomas M. Breuel
breuel at harvard.ARPA
Fri Nov 9 23:51:42 AEST 1984
I fail to see the need for bcd arithmetic even in business computing:
-- bcd numbers use more storage: an 18 digit number takes up 9 bytes,
whereas the corresponding binary representation takes 8 bytes.
-- bcd arithmetic is slower than binary arithmetic: even with special
bcd hardware, still more memory accesses are required to get all
the data into the alu and to write out the result.
-- bcd arithmetic may be 'easier' to convert to ascii strings, but I doubt
that unpacking a bcd number is significantly faster than converting
a binary number to an ascii string. Even if it were, it would
probably be balanced by (2).
If you really want to add a new data type to 'C' then 'veryLong' (i.e.
64bit integers) might be a lot more useful than 'bcd'.
Thomas.
(breuel at harvard)
PS: if you are into commercial computing, why don't you use COBOL?
After all, probably >95% of all business software is written in it...
More information about the Comp.lang.c
mailing list