How was decimal money represented in software?

Many answers to questions about precision float and double recommend using decimal for monetary amounts. This works because today all currencies are decimal, with the exception of MGA and MRO , and those that have 1/5 subunits are still decimal.

But what about software used in the US stock markets when prices were at 1/16 US dollar? The accuracy of binary data types would not be a problem, right?

Going back, how did British accounting software deal with pounds, shillings, and pence until 1971? Did their versions of COBOL have a PIC special offer for this? Have all the amounts been kept in retirement? How was decimalization handled?

+6
decimal currency
source share
3 answers

PL / I had a type specifically for the British currency - I do not know about COBOL. The British currency at one time included farthing or a quarter penny; I'm not sure that these computers should have dealt with them, only half a penny or a happenny.

Accurate accounting usually uses special types - precisely denoting decimal numbers. The new IEEE 754 has floating point decimal support, and some chips (notably IBM pSeries) have this hardware support.

+3
source share

COBOL can do this, for example, PICTURE 9 (4) D88D6 DISPLAY-ST, see http://www.computinghistory.org.uk/downloads/10924 p. 117

+1
source share

1/16 can be represented by four digits as 0.0625. For fractions of this type, you simply add extra decimal places.

0
source share

All Articles