Back
Example 2
Generating a bias.
Problem: all zeros and all ones used to flag special conditions.
Solution: shift (bias) representation of zero exponent up the number line.
Shift representation of exponent 0 to middle of range.
Use formula 2^(n-1) - 1 where n is the size of the exponent.
For our example using 7 bit exponent, calculate bias
2^(7-1)-1 = 63 bias
Recall that we converted the original value to binary form of scientific
notation.
1.10 1110 0101 0110 00 * 2^-2
So, our exponent is -2.
Biasing this exponent gives :
* Add bias to exponent
-2 + 63 = 61 = 011 1101
(1x32+1x16+1x8+1*4+0*2+1*1)
48 + 12 + 1
60 + 1
61
(remember to left pad exponent with zeros, it is a 7 bit number)
Finally, we need to record the sign of the whole value .431 is positive.
Sign bit 0 (positive)
Biased Exponent 011 1101
Significand 1011 1001 0101 1000
Floating point 0 0111101 1011100101011000
Conversion back