Assume we are using the simple model for floating-point representation as given
ID: 3809074 • Letter: A
Question
Assume we are using the simple model for floating-point representation as given in the text (the representation uses a 14-bit format, 5 bits for the exponent with a bias of 15, a normalized mantissa of 8 bits, and a single bit for the number):
a) Show how the computer would represent the numbers 100.0 and .25 using this floating point format.
b) Show how the computer would add the two floating-point numbers in part A by changing one of the numbers so they are both expressed using the same power of 2.
c) Show how the computer would represent the sum in part B using the given floating-point representation. What decimal value for the sum is the computer actually storing? Explain.
Explanation / Answer
Ans: a)
Decimal Value Entered:
100
Single precision (32 bits):
Binary: Status:
Normal
Bit 31
Sign Bit
0
0: +
1: -
Bits 30 - 23
Exponent Field
10000101
Decimal value of exponent field and exponent
133 - 127 = 6
Bits 22 - 0
Significand
1 .10010000000000000000000
Decimal value of the significand
1.5625000
Hexadecimal:
42C80000
Decimal:
100.00000
Ans:
Decimal Value Entered:
0.25
Single precision (32 bits):
Binary: Status:
Normal
Bit 31
Sign Bit
0
0: +
1: -
Bits 30 - 23
Exponent Field
01111101
Decimal value of exponent field and exponent
125 - 127 = -2
Bits 22 - 0
Significand
1 .00000000000000000000000
Decimal value of the significand
1.0000000
Hexadecimal:
3E800000
Decimal:
2.5000000e-1
b) Ans: A + 1.10010000000000000000000 *2^6 = 100
B + 1.00000000000000000000000 *2-2 = 0.25
Alignment Step
A + 1.10010000000000000000000|000 *2^6
B + 0.00000001000000000000000|000 *2^6
A+B + 1.10010001000000000000000|000 *2^6
Post normalization Step
A+B + 1.10010001000000000000000|00 *2^6
Round to Zero
A+B + 1.10010001000000000000000 *2^6 = 100.25
c) Ans: A+B + 1.10010001000000000000000 *2^6 = 100.25
Round to Nearest Even
A+B + 1.10010001000000000000000 *2^6 = 100.25
Round to Plus Infinity
A+B + 1.10010001000000000000000 *2^6 = 100.25
Round to Minus Infinity
A+B + 1.10010001000000000000000 *2^6 = 100.25
c) Ans: A+B + 1.10010001000000000000000 *2^6 = 100.25