Floating Point Summations - HP 9835A Programming Manual

35 series desktop computer assembly development rom
Table of Contents

Advertisement

88
Arithmetic
Floating Point Summations
In the example just completed, you may have noted that to copy the sign the entire exponent
word was copied. What if the exponents were different? The answer is - the exponents must
have been the same. In fact, the only reason the example worked at all was that the exponents
were the same.
If exponents are different, addition of mantissas cannot proceed properly. To add the numbers
it is necessary to make the exponents the same by shifting one of the mantissas an amount
equal to the exponent difference.
This difference is easily found by subtracting the smaller exponent from the larger. If the
difference is eleven or less (the precision of the 12-digit mantissa), it is possible to offset the
mantissa of the number with the smaller exponent.
For example suppose there are two numbers to be added-
X. XXXXXXXXXXX E6
Y. YYYYYYYYYYY E4
By shifting the smaller one to the right by 2 digits (the difference between 6 and 4), it is possible
to align the exponents -
X.XXXXXXXXXXX
E6
O.OYYYYYYYYYYYY
E6
z .
Z Z Z Z Z Z Z Z Z Z Z
E6
As can be readily seen from the example, a shift of more than 11 digits would cause the smaller
value to be all zeroes in the significant 12 digits.
The digits to the right of the 12 most significant digits are lost in the action of shifting. That is, all
except the left-most one. When using the MRX or MRY instructions, this digit is retained in the
A register (bits 0-3) so that it can be used later for rounding purposes.
To use the MRX or MRY instructions, the number of digits to be shifted must be present in the B
register.

Advertisement

Table of Contents
loading

Table of Contents