The following instructions:
173703 000xxx SWMDE Swap Medium Decimal Exponent 173703 001xxx CMDE Compare Medium Decimal Exponent 173703 002xxx LMDE Load Medium Decimal Exponent 173703 003xxx STMDE Store Medium Decimal Exponent 173703 004xxx AMDE Add Medium Decimal Exponent 173703 005xxx SMDE Subtract Medium Decimal Exponent 173703 006xxx MMDE Multiply Medium Decimal Exponent 173703 007xxx DMDE Divide Medium Decimal Exponent 173703 030xxx SWDDE Swap Double Decimal Exponent 173703 031xxx CDDE Compare Double Decimal Exponent 173703 032xxx LDDE Load Double Decimal Exponent 173703 033xxx STDDE Store Double Decimal Exponent 173703 034xxx ADDE Add Double Decimal Exponent 173703 035xxx SDDE Subtract Double Decimal Exponent 173703 036xxx MDDE Multiply Double Decimal Exponent 173703 037xxx DDDE Divide Double Decimal Exponent
perform arithmetic on floating-point numbers which are composed of two binary values, an exponent and a mantissa, but the exponent is interpreted as a power of ten. The same basic data type was used with John von Neumann's JOSS interpreter, and allows reasonably efficient floating-point arithmetic which yields exact decimal results; all operations are done in binary, with only the normalization required afterwards involving successive multiplications or divisions by ten instead of shifts.
The regular floating-point registers are used to hold operands of these types; however, separate decimal exponent load and store instructions are provided, unlike the case with register packed numbers, because a floating-point number may be converted into a modified internal form when loaded into a floating-point register, and such modifications will be different for these types.
The Medium Decimal Exponent Floating type has the following format: one sign bit, followed by an eight-bit exponent in excess-128 notation, followed by a 39-bit mantissa.
In this format, there are two distinct ranges of normalized mantissas, to make the most efficient use of the binary space reserved for a mantissa.
2^39 - 1 is 549,755,813,887, and, thus, most floating-point mantissas will represent eleven decimal digits, followed by a final guard digit which may be either 0, 2, 4, 6, or 8; but a small range of numbers will have a twelfth decimal digit, as follows:
High Range: 549,755,813,880 1.09951142376 549,755,813,879 1.099511423758 ... 500,000,000,001 1.000000000002 500,000,000,000 1.00000000000 Low Range: 499,999,999,999 0.999999999998 499,999,999,998 0.999999999996 ... 499,999,999,995 0.99999999999 ... 54,975,581,390 0.10995114238 54,975,581,389 0.109951142378
The Double Decimal Exponent Floating type has the following format: one sign bit, followed by an eleven-bit exponent in excess-1024 notation, followed by a 52-bit mantissa.
2^52 - 1 is 4,503,599,627,370,495, and, thus, most floating-point mantissas will represent fifteen decimal digits, followed by a final guard digit representing an additional fraction of 0, 1/4, 1/2, or 3/4, but a small range of numbers will have a sixteenth decimal digit, as follows:
High Range: 4,503,599,627,370,480 1.125899906842620 4,503,599,627,370,479 1.12589990684261975 ... 4,000,000,000,000,001 1.00000000000000025 4,000,000,000,000,000 1.000000000000000 Low Range: 3,999,999,999,999,999 0.99999999999999975 3,999,999,999,999,998 0.9999999999999995 3,999,999,999,999,997 0.99999999999999925 3,999,999,999,999,996 0.999999999999999 ... 450,359,962,737,052 0.112589990684263 450,359,962,737,051 0.11258999068426275 450,359,962,737,050 0.1125899906842625 450,359,962,737,049 0.11258999068426225
In both cases, it is permitted for a computation to produce a super-normalized result that slightly exceeds the upper limit of the high range shown, bringing the mantissa up to its maximum possible binary value, since the test for a result requiring division by ten to be normalized will be based on a binary carry out.
As well, the fraction 1/10, when expressed in binary, is 0.0001100110011001100110011... and, thus, the threshold for multiplying by 10 may be set as the simpler quantity 0.00011, rather than the precise lower limit of the low ranges shown above, allowing denormal numbers with mantissas as low as 51,539,607,552, representing 0.103079215104, for the Medium Decimal Exponent Floating data type, and with mantissas as low as 422,212,465,065,984, representing 0.105553116266496, for the Long Decimal Exponent Floating data type. Thus, this means that the extra digit, although possible for a narrow range of numbers, is only guaranteed to be present for a significantly narrower range of numbers.
Except in the case where a 24-bit word is specified instead of a 32-bit word, in which case the opcodes for instructions acting on the Long Decimal Exponent Floating data type will act on operands having the format of the Medium Decimal Exponent Floating data type as described here, this data type is not available when any alternate memory width is specified.
If this architecture is expanded so that other Decimal Exponent Floating data types are defined, it is possible that for some of them the high portion of the mantissa range would be so narrow that instead of merely shortening the guaranteed high portion, a simple multiply-by-ten test based on binary 0.00011 (or 3/32nds) would lead to some denormal quantities having one decimal digit of precision less than numbers in the low portion. In that case, the test used would be changed to have a threshold of binary 0.000110011 (or 51/512ths) or to a more precise test if required to avoid this, so that the standard precision for the low portion of the mantissa range would be guaranteed despite the presence of an allowed denormal range. In that case, the more precise test used would apply to all Decimal Exponent Floating formats defined.
Due to the repetitive nature of the fraction 1/10 represented in binary, when it is necessary to divide a mantissa by 10 to align it, it may be noted that multiplying a number by 32/5 (or 64 times 1/10) can be broken down into a small number of shift and add operations:
Multiplying by: 1.100110011001100110011001100110011001100110011001100110011001100 is equivalent to multiplying by: 1.1 1.00000000000000000000000000000001 1.0000000000000001 1.00000001 1.0001
This algorithm, or a similar one, or perhaps an even better one, was described by Robin A. Vowels in a 1992 paper in the Australian Computer Journal.
It may also be noted that instead of performing five consecutive shifts and adds, one could simply leave 1.1 times the input as two numbers, the input and .1 times the input. Doing the next multiplication the same way, copying and shifting without actually doing the addition, leaves one with four numbers to work with. These four numbers can then be reduced to two using two carry-save adder stages, and then another lazy multiplication increases the number of numbers to four again. In this way, one would only need to propagate carries after the final multiplication.