Floating-Point Multiplication
1.0102×2-1 × –1.1102×2-2 = –1.0012×2-2
The following steps show how to multiply the above numbers in scientific notation.
Again, we assume 4 bits of precision (or 3 bits of fraction).
- Step 1. Calculating the Exponent of the Product
-
Product exponent (manual) = (–1) + (–2) = –3
Product exponent (hardware)
= EZ = EX + EY – Bias
= (–1+127) + (–2+127) – 127
= 124 (value = –3 = 124–127)
- Step 2. Multiplying the Significands
-
Since sign
SX≠SY , sign of product SZ=1 (negative).
The result of multiplication is as follows:
1.0102×2-1 × –1.1102×2-2 = –10.0011002×2-3
- Step 3. Normalizing the Product
-
–10.0011002×2-3 = –1.00011002×2-2
Shifting right by 1 bit has to be followed by incrementing the exponent.
|
|
1.010
× 1.110
————————————
0000
1010
1010
+ 1010
————————————
10001100 or
10.001100
|
|
- Step 4. Rounding the Significand
- We assumed 4 bits of precision or 3 bits of fraction.
Round the significand to nearest digit:
–1.00011002×2-2 ≈ –1.0012×2-2
- Step 5. Checking for Overflow or Underflow
- Check whether exponent becomes too large (overflow) or too small (underflow).
Q: What did the grape do when it got stepped on?
A: It let out a little wine!
|