Consider the values A = 2.0 × 1030, B = -2.0 × 1030 C = 1.0. Assume, that the floating point numbers are represented with 32 bits. What are the values of X and Y, when the following sequence of operations are executed on a computer? X = A + B Y = A + C X = X + C Y = Y + B

Consider the values A = 2.0 × 1030, B = -2.0 × 1030 C = 1.0. Assume, that the floating point numbers are represented with 32 bits. What are the values of X and Y, when the following sequence of operations are executed on a computer? X = A + B Y = A + C X = X + C Y = Y + B Correct Answer X = 1.0, Y = 0.0

Concept:

Floating point have precision up to 6 places only.

Explanation:

Since A and B are floating point integers, and floating point have precision up to 6 places. Hence these floating point operations will give the following results.

X = A + B = 0.0

C = 1.0 and A has 1030 digits, C becomes negligible. As the precision is only up to 6 decimal places, it will remain A.

Y = A + C = A

X = X + C = 0.0 + 1.0 = 1.0

Y = Y + B = A + B = 0.0

Related Questions

How far is point 'R' from Point 'T'? Statement (I): Point 'R' is 5 metres to the north of point 'M'. Point 'U' is 4 metres to the east of point 'R'. Point 'T' is to the west of point 'R' such that points 'U' 'R' and 'T' form a straight line of  metres. Statement (II): Point 'Z' is metres to the south of point 'T'. Point 'U' is  metres to the east of point 'T'. Point 'M' is  metres to the east of point 'Z'. Point 'R' is  metres to the north of point 'M'. Point 'R' lies on the line formed by joining points 'T' and 'U'.