Section 21.4: Real Addition (Frame 2)                     [prev][home][next]

When adding two floating point numbers, they must have the same exponent. If they don't, then the numbers have to be modified so they do have the same exponent. This is done by using the larger of the two exponents as the exponent of the result, and adjusting the operand which has the smaller exponent. For example, suppose we wanted to add:

           0.56740 x 105
     +     0.38400 x 102
     --------------------

If we were to force the top number's exponent to the match the lower's, we would end up with a mantissa that is greater than 1 which is not representable in our system. That is, we would have to replace 0.56740&tiems;105 with 567.40×102, getting a mantissa greater than 1. Instead we can change the bottom number by shifting its mantissa right while adding 1 to its exponent, until its exponent is equal to 5, ending up with 0.00038×105. Note that we lose the 4 because it is impossible in our scheme to store more than 5 digits of mantissa. Even if we increase the number of digits, we will always have some limit.