Page 230 - Introduction to Microcontrollers Architecture, Programming, and Interfacing of The Motorola 68HC12
P. 230
7.5 Floating-Point Arithmetic and Conversion 207
(The enclosed bits are the bits beyond the 23 fractional bits of the significand.) The
result, when rounded, yields 2° * 1.0 . . . 010. By examining a number of cases,
one can see that only three bits need to be kept in the unnormalization process, namely,
where g is the guard bit, r is the round bit, and s is the sticky bit. When a bit b is
shifted out of the significand in the unnormalization process.
Notice that if s ever becomes equal to 1 in the unnormalization process, it stays equal to
1 thereafter or "sticks" to 1. With these three bits, rounding is accomplished by
incrementing the result by 1 if
or
If adding the significands or rounding causes an overflow in the significand bits (only one
of these can occur), a renormalization step is required. For example,
2° * 1.1111 .. . 1
+ 2-23 * Lino . . . 0
l
becomes, after rounding, 2° * 10.0 . . . 0 Renormalization yields 2 * 1.0
.. . 0, which is the correct rounded result, and no further rounding is necessary.
Actually, it is just as easy to save one byte for rounding as it is to save three bits,
so that one can use six rounding bits instead of one, as follows.
The appropriate generalization of (15) can be pictured as
while (16) is exactly the same as before with r replaced by 15 ... TO