Question

Consider three registers R1, R2, and R3 that store numbers in IEEE-754 single precision floating point format. Assume that R1 and R2 contain the values (in hexadecimal notation) 0x42200000 and 0xC1200000, respectively.

If R3=R1R2\text{R3} = \frac{\text{R1}}{\text{R2}}, what is the value stored in R3?

Choose one option
Official answer and solution
Official answer
B
From
Official GATE 2020 answer key

Solution

Decode the IEEE-754 single precision floating point numbers, perform the division, and re-encode the result.

Decode R1 (0x42200000):

  • In binary: 0 10000100 01000000000000000000000
  • Sign bit: s=0s = 0 (positive)
  • Biased exponent: E=100001002=13210  ⟹  E = 10000100_2 = 132_{10} \implies Unbiased exponent e=132−127=5e = 132 - 127 = 5
  • Mantissa: M=1.012=1+0.25=1.25M = 1.01_2 = 1 + 0.25 = 1.25
  • Value: R1=+1.25×25=1.25×32=40.0\text{R1} = +1.25 \times 2^5 = 1.25 \times 32 = 40.0

Decode R2 (0xC1200000):

  • In binary: 1 10000010 01000000000000000000000
  • Sign bit: s=1s = 1 (negative)
  • Biased exponent: E=100000102=13010  ⟹  E = 10000010_2 = 130_{10} \implies Unbiased exponent e=130−127=3e = 130 - 127 = 3
  • Mantissa: M=1.012=1.25M = 1.01_2 = 1.25
  • Value: R2=−1.25×23=−1.25×8=−10.0\text{R2} = -1.25 \times 2^3 = -1.25 \times 8 = -10.0

Perform division:

R3=R1R2=40.0−10.0=−4.0\text{R3} = \frac{\text{R1}}{\text{R2}} = \frac{40.0}{-10.0} = -4.0

Encode −4.0-4.0 into IEEE-754 single precision format:

  • Sign bit: s=1s = 1 (since number is negative)
  • Magnitude: 4.0=1.02×224.0 = 1.0_2 \times 2^2
  • Biased exponent: E=2+127=12910=100000012E = 2 + 127 = 129_{10} = 10000001_2
  • Fraction field: 23 zeros (0000…00000\dots 0)
  • Combined 32-bit word: 1 10000001 00000000000000000000000
  • Hexadecimal: 1100 0000 1000 0000 0000 0000 0000 0000 = 0xC0800000.
Final answer

B

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2020 Computer Science and Information Technology (CS)
Question
39 of 65, printed as CS Q.29
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.