Floating Point Division - HP 9835A Programming Manual

35 series desktop computer assembly development rom
Table of Contents

Advertisement

92
Arithmetic
After the final partial product has been calculated by the final execution of the FMP instruction,
it is possible that a non-zero digit may be present in bits 0-3 of the A register. Such a digit is
necessarily the most significant digit of the final product. In this case, another MRY execution is
required. Further, the exponent of the product (which was initially estimated as the sum of the
operand's exponents) must be incremented by one to reflect this power-of-ten shift.
Upon each step of partial product summation, a significant digit is lost due to the shift. This
can't be helped. In general, the product of two 12-digit numbers has 24 digits of precision, but
the bottom 12 digits must be discarded since only 12 BCD digits are stored in a mantissa. An
error analysis of the algorithm discloses that dropping these digits causes the answer, on
average, to be slightly smaller than it should be. However, rounding introduces a similar error,
but in the other direction. Note that the process did not round each partial product.
The discarded digits can be inspected before they are permanently lost. The MRY instruction
causes the digit to be placed in the A register (in bits 0 to 3). This provides an easy way for a
rounding mechanism to check on those digits as they are discarded. The rounding routine
needs to save the last digit discarded for use in rounding in the event the last use of FMP
produces no overflow digit.
Finally, it should be noted that you can put WXYZ into B at the very start of the process and
simply shift Bright 4 bits (with an SBR 4 instruction) between each execution of FMP. After all,
FMP uses only bits 0 to 3 of the register as the number of times to add Ar1 and Ar2.
Floating Point Division
There are many possible algorithms to accomplish floating-point division. The one presented
here was chosen because of its effective use of the machine instructions and data structures
employed by the processor and operating system.
Remembering that full-precision numbers consist of both a signed mantissa and a signed
exponent, use can be made of the mathematical properties of both to reduce the division
problem to manageable proportions. Suppose that you have two full-precision values to
divide -
- 4.8E3
+
1.5E - 2

Advertisement

Table of Contents
loading

Table of Contents