Assume we are using the simple model for the floating-point representation given in this book (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a zero-normalized mantissa of 8 bits, and a single sign bit). What is the real number represented by 01110010000101? Show how the computer would add this number with 238.5 using the floating-point addition algorithm. Verify your results by adding them in decimal, what is the relative error in the representation of the output sum. Note from student: Attempting to convert 01110010000101 to decimal resulted in 12,448. I'm not sure if this is correct and I cannot find a converter online. Any help would be appreciated!
Solution for the problem is provided below, please comment if any doubts:
Here the 14-bit floating point representation is used with:
5 bit exponent, 8 bit zero-normalized mantissa and a sign bit.
Part I:
The floating point number given is: 01110010000101
The sign bit = 0, Positive
The 5 bit exponent = 11100 = 28, but it is a biased value by 15, thus the original exponent value =28-15=13
The mantissa part is: 10000101, since zero normalized, the mantissa will be =
= 0.10000101
Now shift the point to 13 bits right and place 0’s if place is not there
0.10000101*213 = 1000010100000 = 4256
Thus the real number equivalent of 01110010000101 = 4256
Part II:
To add with 238.5
First convert 238.5 to floating point format
First convert to binary, 238.5 = 11101110.1
Now convert to zero normalized mantissa and compute the exponent as the shifted bits of point.
11101110.1=0.111011101*2^8
Now perform the addition of , 0.10000101*213 and 0.111011101*28
For that first make both the exponents same
0.111011101*28 = 0.00000111011101*213
Now perform the addition of equal exponent numbers
0.1000010100000*213 + 0.00000111011101*213
=0.10001001111101*213
Now convert back to floating point, eliminate bits after 8 bits in result
Add 15 to exponent, 13+15=28= 11100
Mantissa: 10001001
Sign: 0
Result= 01110010001001
Convert back to decimal
= 0. 10001001*213
=1000100100000
=4384
The actual result has to be = 4256+238.5 =4494.5
The relative error = (4494.5-4384)/ 4494.5 = 0.02 or 2%
Get Answers For Free
Most questions answered within 1 hours.