Floating-Point Subtraction

1.0002×2-3 – 1.0002×22 = –1.0002×22
The following steps show how to perform the subtraction on the above numbers in scientific notation.

For simplicity, we assume 4 bits of precision (or 3 bits of fraction).
Step 1. Making Exponents Equal
Shift the significand of the lesser exponent right until its exponent matches the larger number:
  1.0002×2-3 = 0.000012×22
Step 2. Performing Subtraction
Use 2’s complement notation to find the difference as follows:
    0.000012×22 – 1.00002×22
 = –0.111112×22
     adding a sign bit

    01.00000  (subtrahend)
    10.11111  (reverse)
  + 00.00001  (add 1)
  ———————————
    11.00000  (2’s compl.) 

    00.00001  (minuend)
  + 11.00000  (2’s compl.)
  ———————————
    11.00001  (difference)

    11.00001  (difference)
    00.11110  (reverse)
  + 00.00001  (add 1) 
  ———————————
   –00.11111
Step 3. Normalizing the Difference
   –0.111112×22 = –1.11112×21
Step 4. Rounding the Significand
Round the significand to nearest digit: –1.11112×21 ≈ –10.0002×21

Step 3. Normalizing the Difference
   –10.0002×21 = –1.00002×22
Step 4. Rounding the Significand
Round the significand to nearest digit: –1.00002×22 = –1.0002×22

Step 5. Checking for Overflow or Underflow
Check whether exponent becomes too large (overflow) or too small (underflow).



      Q: How do you make a skunk stop smelling?    
      A: Pinch its nose closed.