Following floating point number format is given:
f is a fraction represented by a 6-bit mantissa (includes sign bit) in sign-magnitude form.
e is a 4-bit exponent (includes sign bit) in sign-magnitude form.
N = f x 2^e is a floating point number.
Let A = 54.75 in decimal and B = 9.5 in decimal.
a. Represent A and B as floating point numbers in the above format.
b. What is the percentage error due to addition of A and B to one position beyond the decimal point in the addition operation?
GATE 1997 · Digital Logic · Floating Point Representation · medium
Answer: A is represented as 0.11011 x 2^6 (=54.0) and B as 0.10011 x 2^4 (=9.5). The percentage error in their addition is approximately 1.17%.
Convert A = 54.75 to binary and normalize: 54 in binary = 110110; 0.75 in binary = 0.11
So 54.75 = 110110.11
Normalized: 0.11011011 x 2^6
With 5-bit mantissa: 0.11011 x 2^6 (truncating the last '011' -> keep 5 bits: 11011)
Stored: sign=0, mantissa=11011, exponent sign=0, exponent magnitude=110 (6 in binary = 110)
A stored = 0.11011 x 2^6 = 0.84375 x 64 = 54.0
Convert B = 9.5 to binary and normalize: 9 in binary = 1001; 0.5 in binary = 0.1
So 9.5 = 1001.1
Normalized: 0.10011 x 2^4
With 5-bit mantissa: 0.10011 (exact, fits in 5 bits)
Stored: sign=0, mantissa=10011, exponent sign=0, exponent magnitude=100 (4 in binary = 100)
B stored = 0.10011 x 2^4 = 0.59375 x 16 = 9.5
Compute stored sum and exact sum: Stored A = 54.0, stored B = 9.5
Stored sum = 63.5
Exact sum = 64.25
Error = |64.25 - 63.5| = 0.75
Percentage error = (0.75 / 64.25) x 100 = 1.167%