Redirected
in CO and Architecture edited by
10,356 views
10 votes
10 votes

Consider the $\textsf{IEEE-754}$ single precision floating point numbers $\text{P} = \textsf{0xC1800000}$ and $\text{Q} = \textsf{0x3F5C2EF4}.$

Which one of the following corresponds to the product of these numbers $(\text{i.e., P} \times \mathrm{Q} ),$ represented in the $\textsf{IEEE-754}$ single precision format?

  1. $\textsf{0x404C2EF4}$
  2. $\textsf{0x405C2EF4}$
  3. $\textsf{0xC15C2EF4}$
  4. $\textsf{0xC14C2EF4}$
in CO and Architecture edited by
by
10.4k views

3 Comments

Answer : C

P = – $2^{4}$

Set the most significant bit and add 4 to next 8 bits of Q to get (P * Q).
0
0
We can save some time for this question also. If we see the options, $C2EF4$ is common in all the options at the end. So, we have to find initial $12$ bits in $P \times Q$

$1)$ Sign of $P \times Q$ = (Sign of $P$) $\oplus$ (Sign of $Q$)

$2)$ Exponent of $P \times Q$ =  (Exponent of $P$) $+$ (Exponent of $Q$) $- \ 127$

$3) $ Mantissa of $P \times Q$ = 1.Mantissa of P $\times$ 1.Mantissa of Q  

Since, $P = 1100 \  0001 \  1000 ...$ and

$Q = 0011 \  1111 \  0101 ...$

So, Sign of  $P \times Q$ = $1 \oplus 0 = 1$

Exponent of $P \times Q$ = $131 + 126 \  – \  127 = 130$

Mantissa of $P \times Q = 1.000... \times 1.101... = 1.101...$

So, $P \times Q =  1 \ \ 10000010 \ \ 101...$

So, $P \times Q = 1100 \ \ 0001 \  \ 0101 = C15$ (Option (C))
6
6
edited by

Beautifully Explained about Floating point Representation

https://www.rfwireless-world.com/Tutorials/floating-point-tutorial.html

1
1

2 Answers

15 votes
15 votes

P = 0xC1800000 = 1100 0001 1000 0000 0000 0000 0000 0000 

IEEE 754 Single Precision Format (32-bit) – 

 Sign (1 bit) Biased Exponent (8 bits) Mantissa (23 bits)
1 10000011 0000 0000 0000 0000 0000 000

Biased Exponent = 131 

Actual Exponent = Biased Exponent  – Bias ($2^{8-1} - 1$)  = 131 -127 = 4

Mantissa = 0000 0000 0000 0000 0000 000

Actual Number = 1.00000000000000000000000 * $2^{4}$ = 16 (It is negative 16 because sign bit is 1)

 

Q = 0x3F5C2EF4 = 0011 1111 0101 1100 0010 1110 1111 0100 

Sign = 0 (Positive),

Biased Exponent = 01111110 = 126 

Actual Exponent = 126-127 =  $2^{-1}$ 

Mantissa = 1011100 0010 1110 1111 0100

 

P * Q = 1.0000 * 1.1011100 0010 1110 1111 0100 * $2^{4}$ *  $2^{-1}$  = 1.10111000010111011110100 * $2^{3}$  

Representing back to IEEE 754

Sign Bit = 1

Biased Exponent = 127+3 = 130 = 10000010 

Mantissa: 1011 1000 0101 1101 1110 100

1 1000 0010 1011 1000 0101 1101 1110 100

= 1100 0001 0101 1100 0010 1110 1111 0100 = C15C2EF4

4 votes
4 votes

Solution 

Answer:

Related questions