GATE / CS ARCHIVE

GATE CSE 1997 / QUESTION 72(b)

Floating-point addition with explicit rounding

Computer Organization & Architecture · Data Representation & Arithmetic · Full GATE CSE 1997 paper

GATE 1997, Q72(b) 2 marks · Descriptive
Report issue

Data Representation & Arithmetic

Question 72(b), GATE 1997: A floating-point value is n=(f,e)=f·2^e. The fractional mantissa f has 6 bits including its sign bit, in sign-magnitude form. The exponent e has 4 bits including its sign bit, also sign-magnitude. A=54.75 and B=9.75 in decimal. No rounding mode, guard-bit convention, or normalization rule is explicitly supplied; use the conventional normalized fraction 1/2≤|f|<1 and state the rounding assumption. Show the floating-point addition of A and B.
Question 72(b), GATE 1997: A floating-point value is n=(f,e)=f·2^e. The fractional mantissa f has 6 bits including its sign bit, in sign-magnitude form. The exponent e has 4 bits including its sign bit, also sign-magnitude. A=54.75 and B=9.75 in decimal. No rounding mode, guard-bit convention, or normalization rule is explicitly supplied; use the conventional normalized fraction 1/2≤|f|<1 and state the rounding assumption. Show the floating-point addition of A and B.
Tap to enlarge
Answer & solution

Answer: With five-bit mantissa chopping: result (0 11111,0 110)=62. Under round-to-nearest/ties-to-even throughout, result=64 instead. (no official key was published)

Use the chopping encodings A≈.11011₂×26=54 and B≈.10011₂×24=9.5. To add, align both to the larger exponent +6. Shifting B's fraction right by two places gives .0010011₂×26. With only five fraction positions and chopping on alignment, this becomes .00100₂×26=8.

The stored-width addition is
  .11011 × 2^6
+ .00100 × 2^6
= .11111 × 2^6.

The mantissa is already normalized, lying between 1/2 and 1, and has five fraction bits. There is no carry that requires an exponent increment. Store mantissa 0|11111 and exponent 0|110, representing (31/32)×64=62. Both fields are within range.

Keeping guard bits changes the intermediate arithmetic but not this particular chopped final answer. With full aligned precision, the represented inputs sum to .1111111₂×26=63.5. Chopping that result to five fraction bits again yields .11111₂×26=62. Thus a final value of 62 does not establish whether guard bits were used; both stated chopping paths happen to agree here.

Under a different policy, round-to-nearest with ties-to-even encodes the inputs as 54 and 10. Their exact sum is 64=.10000₂×27, already representable, so the stored result is mantissa 0|10000, exponent 0|111. The true decimal-input sum is 64.5, which also rounds to 64 at this precision. The source does not choose between these policies. This solution therefore reports 62 only under chopping, with 64 as a clearly separate rounded alternative; it does not present an unspecified hardware behavior as an official answer.

Original paper, page 10