###### Question 9843 – Digital-Logic-Design

February 13, 2024###### Question 9864 – Digital-Logic-Design

February 13, 2024# Question 9845 – Digital-Logic-Design

Consider the values A = 2.0 x 10^{30}, B = -2.0 x 10^{30}, C = 1.0, and the sequence

X: = A + B Y: = A + C X: = X + C Y: = Y + B

executed on a computer where floating-point numbers are represented with 32 bits. The values for X and Y will be

Correct Answer: B

Question 48 Explanation:

Given: 32 bits representation. So, the maximum precision can be 32 bits (In 32-bit IEEE representation, maximum precision is 24 bits but we take best case here). This means approximately 10 digits.

A = 2.0 * 10

So, A + C should make the 31

So, Y + B will return 0.0 while X + C will return 1.0.

A = 2.0 * 10

^{30}, C = 1.0So, A + C should make the 31

^{st}digit to 1, which is surely outside the precision level of A (it is 31^{st}digit and not 31^{st}bit). So, this addition will just return the value of A which will be assigned to Y.So, Y + B will return 0.0 while X + C will return 1.0.

X = 1.0, Y = 1.0

X = 1.0, Y = 0.0

X = 0.0, Y = 1.0

X = 0.0, Y = 0.0

Subscribe

Login

0 Comments