Dark Mode

1,868 views

3 votes

Consider three floating point numbers $\textit{A, B}$ and $\textit{C}$ stored in registers $\text{R}_{\text{A}}, \text{R}_{\text{B}}$ and $\text{R}_{\text{C}},$ respectively as per $\textsf{IEEE-754}$ single precision floating point format. The $\text{32-bit}$ content stored in these registers $\text{(in hexadecimal form)}$ are as follows.

$\begin{array} {|c|c|c|} \hline \text{R}_{\text{A}} = \text{0xC1400000} & \text{R}_{\text{B}} = \text{0x42100000} & \text{R}_{\text{C}} = \text{0x41400000} \\\hline \end{array}$

Which one of the following is $\text{FALSE}?$

- $\textit{A + C} = 0$
- $\textit{C = A + B}$
- $\textit{B =3C}$
- $\textit{(B – C)} > 0$

5 votes

@abinayasri In IEEE-754 single precision, the $32$ bits are divided into :- Sign (1bit), Biased Exponent (8 bits) and Mantissa (23 bits) Fields.

**In the sign field : 1 → -ve no. , 0 → +ve no.**

So for $R_A: 0xC1400000 = 1100 \;0001\;0100 \; 0000\; 0000\; 0000\; 0000\; 0000$

Here the first bit **(Most Significant bit on left)** is 1. Hence the number is -ve.

1

1 vote

Given that Numbers are in IEEE-754 single precision.

Representation :: $\text{1 sign bit, 8 exponent bits and 23 Mantissa Bits}$

$\text{Decimal value} = (-1)^{\text{Sign bit}}\times(1.Mantissa)\times(2)^{exponent-127}$

$R_A = 0xC1400000 = 1100 \;0001\;0100 \; 0000\; 0000\; 0000\; 0000\; 0000$

$R_A = 0xC1400000 = \underbrace{1}\underbrace{100 \;0001\;0}\underbrace{100 \; 0000\; 0000\; 0000\; 0000\; 0000}$

$\text{Decimal value of R}_A = (-1)^{\text{1}}\times(1.1000000000..)\times(2)^{130-127}=-(1100)_2 = -12$

$R_B = 0x42100000 = 0100 \;0010\;0001 \; 0000\; 0000\; 0000\; 0000\; 0000$

$R_B = 0x42100000 = \underbrace{0}\underbrace{100 \;0010\;0}\underbrace{001 \; 0000\; 0000\; 0000\; 0000\; 0000}$

$\text{Decimal value of R}_B = (-1)^{\text{0}}\times(1.001000000000..)\times(2)^{132-127}=-(100100)_2 = 36$

$R_C = 0x41400000 = 0100 \;0001\;0100 \; 0000\; 0000\; 0000\; 0000\; 0000$

$R_C = 0x41400000 = \underbrace{0}\underbrace{100 \;0001\;0}\underbrace{100 \; 0000\; 0000\; 0000\; 0000\; 0000}$

$\text{Decimal value of R}_C= (-1)^{\text{0}}\times(1.1000000000..)\times(2)^{130-127}=(1100)_2 = 12$

$\therefore C=A+B\;\; is\; false.$

Alternate :

$R_A = 0xC1400000, R_B = 0x42100000 \;\;and\;\; R_C = 0x41400000$

- By observing $R_A$ and $R_C$ only MSB bit is different ===> $R_C$ = -$R_A$ ===> $R_C$ + $R_A$ = 0
- By observing $R_B$ and $R_C$, $R_B$ exponent part is higher than $R_C$ exponent part ===> $R_B$ > $R_C$ ===> $R_B$ - $R_C$ > 0

Now Verify other two options.