GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Compute arithmetic on IEEE binary32 encodings

3 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

Decode finite binary32 operands, carry out the requested arithmetic, normalize and select the encoded result. Division/multiplication combine exponents and significands; addition first aligns exponents.

2 marks · MCQ
Report issue

Adding two IEEE 754 binary32 values

Data Representation & Arithmetic

Question 36, GATE 2026: X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Step through it (9 steps)

Givens and goal

X and Y are IEEE 754 single-precision values with hexadecimal bit patterns 35C00000 and 34A00000. Find the bit pattern for Z=X+Y among A 35C80000, B 35CC0000, C 35E80000, D 35EC0000.

Approach

Decode sign, biased exponent and fraction; align exponents, add significands, and re-encode the exact sum.

Step-by-step solution

1. Both operands are positive normal IEEE 754 binary32 numbers. The exponent field of 35C00000 is 107, so its unbiased exponent is −20. Its fraction field is 400000, giving significand 1.5. Thus X = 1.5 × 2−20.
2. For 34A00000 the exponent field is 105, giving unbiased exponent −22; fraction 200000 gives significand 1.25. Thus Y = 1.25 × 2−22 = 0.3125 × 2−20.
3. Their sum is 1.8125 × 2−20. Since 1 ≤ 1.8125 < 2, no exponent renormalization is required. The fraction is 0.8125 = 13/16, which has an exact terminating binary expansion.
4. The exponent bits remain 107, contributing 35800000. The stored fraction is (13/16) × 223 = 680000 in hexadecimal. Combining the fields yields 35E80000. No rounding error occurs here.

Computational check: Python struct unpacked both binary32 operands and repacked their sum, obtaining 0x35e80000. This complements the exact field-level derivation; it is not the sole justification.

Binary significand check: X=1.1₂×2−20 and Y=1.01₂×2−22=0.0101₂×2−20. Their sum is 1.1101₂×2−20. Dropping the implicit leading 1 leaves fraction bits 1101 followed by nineteen zeros, exactly the hexadecimal fraction 680000. Since all significant bits fit within binary32 precision, the rounding mode does not alter the answer here.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 45, GATE 2023: Multiply binary32 values P=0xC1800000 and Q=0x3F5C2EF4. Which binary32 encoding results? A 0x404C2EF4; B 0x405C2EF4; C 0xC15C2EF4; D 0xC14C2EF4.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

P=0xC1800000 is−16=−2⁴. Q is a positive normal binary32 number with exponent 126 and fraction 0x5C2EF4. Multiplying by−2⁴ flips the sign and raises the biased exponent from 126 to 130, leaving the fraction unchanged. The result is 0xC15C2EF4, option C. Scaling remains within the normal range and is exact.

Teaching detail. A normal binary32 value is (−1)s·(1+fraction/2²³)·2e−127. For P the sign is 1, biased exponent 131, and fraction zero, yielding −16. For Q the sign is 0 and biased exponent 126. Exact scaling by 16 adds four to that exponent, while the negative multiplier changes the sign bit to 1. Packing sign 1, exponent 130, and unchanged fraction 0x5C2EF4 yields the stated hexadecimal word. No significand multiplication or rounding is needed for this power-of-two scaling.

Original paper, page 48 · Answer key

2 marks · MCQ
Report issue

Data Representation & Arithmetic

Question 29, GATE 2020: R1=0x42200000 and R2=0xC1200000 are IEEE-754 single-precision bit patterns. Find the pattern for R3=R1/R2. A 0x40800000; B 0xC0800000; C 0x83400000; D 0xC8500000.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

Step through it (10 steps)

Worked explanation

For a normal single-precision value, decode (−1)s×(1+fraction/223)×2E−127. R1 has s=0,E=132,fraction=0x200000, so its significand is 1+1/4=1.25 and its value is 40. R2 has s=1,E=130,the same fraction, so it is −10. Divide the represented values, not the hexadecimal integers: 40/(−10)=−4. Normalize −4 as −1.0×2², yielding sign 1, exponent 129=10000001₂ and all-zero fraction. Packing those fields gives 0x80000000+0x40800000=0xC0800000. No rounding is needed because all values are exact powers-of-two fractions.

Derivation and answer

0x42200000 represents+1.25·2⁵=40. 0xC1200000 represents−1.25·2³=−10. Their quotient is−4=−1.0·2². Its sign bit is 1, biased exponent 129, fraction 0, yielding 0xC0800000, B.

Original paper, page 10 · Answer key