ISRO | ISRO CS 2008 |问题22

计算机使用8位尾数和2位指数。如果a=0.052且b=28E+11,则b+a–b将 (A) 导致溢出错误 (B) 导致下溢错误 (C) 0 (D) 5.28 E+11 答复: (C) 说明:

null
Since the computer uses 8 digit mantissa
and 2 digit exponent:

a = 0.052, mantissa = 0.52, exponent = −1.
b = 28E+11, mantissa = 0.28, exponent = 13.

To add b+a, Small exponent number, a is shifted
to 13-(-1) = 14 places to right side
a = 0.0000000000000052E+13

Since, computer uses only 8 digit mantissa,
digits beyond 8th position will be discarded.
So a = 0.00000000E+13 = 0.0 E+13

b + a = (0.28E + 13) + (0.0E + 13 )
      = 0.28E + 13
Then b + a - b = (0.28E + 13) - (0.28E + 13)
               = 0

因此,选项(C)是正确的。 这个问题的小测验

© 版权声明
THE END
喜欢就支持一下吧
点赞8 分享