Page 227 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 227
204 Chapter 7 Arithmetic Operations
4
2 * 1.00 .. . 0
2
+ 2 * 1.00 . . . 0
we first unnormalize the number with the smaller exponent and then add as shown,
4
2 * 1.000 .. . 0
4
+ 2 * 0.010 . . . 0
4
2 * 1.010 .. . 0
(For this example and all those that follow, we give the value of the exponent in decimal
and the 24-bit magnitude of the significand in binary.) Sometimes, as in adding,
4
2 * 1.00 .. . 0
4
+ 2 * 1.00 . . . 0
4
2 *10.00 .. . 0
the sum will have to be renormalized before it is used elsewhere. In this example
5
2 * 1.00 .. . 0
is the renormalization step. Notice that the unnormalization process consists of
repeatedly shifting the magnitude of the significand right one bit and incrementing the
exponent until the two exponents are equal. The renormalization process after addition or
subtraction may also require several steps of shifting the magnitude of the significand left
and decrementing the exponent. For example,
4
2 * 1.0010 .. . 0
4
- 2 * 1.0000 . . . 0
4
2 * 0.0010 .. . 0
requires three left shifts of the significand magnitude and three decrements of the
exponent to get the normalized result:
1
2 * 1.00 .. . 0
With multiplication, the exponents are added and the significands are multiplied to get
the product. For normalized numbers, the product of the significands is always less than
4, so that one renormalization step may be required. The step in this case consists of
shifting the magnitude of the significand right one bit and incrementing the exponent.
With division, the significands are divided and the exponents are subtracted. With
normalized numbers, the quotient may require one renormalization step of shifting the
magnitude of the significand left one bit and decrementing the exponent. This step is
required only when the magnitude of the divisor significand is larger than the magnitude
of the dividend significand. With multiplication or division it must be remembered also
that the exponents are biased by 127 so that the sum or difference of the exponents must
be rebiased to get the proper biased representation of the resulting exponent.