计算机的错误计算(四十四)

摘要  机器算错了吗?是的,算错了!机器算对了吗?是的,算对了。

       计算机的错误计算(一)中例1 介绍了计算机对 Rump 给出的算式  

(其中

的错误计算:正确结果是,但是,计算机给出了错误结果。比如,在 Sun机器上用 Fortran程序计算, 32位、64位精度下的结果分别为

,

.

       下面在十进制的 8位与 16位的有效位数下分别计算该式。

       若保留 8位有效数字,则计算过程与结果如下:

333.75\times33096.0^6+77617.0^2\times(11\times77617.0^2\times33096.0^2-33096.0^6-121\times33096.0^4-2) +5.5\times33096.0^8+\frac{77617.0}{2\times33096.0}\\ \textcolor{blue}{\approx} \,333.75\times1.3141745\times10^{27}+6.0243987\times10^{9}\times(11\times6.0243987\times10^{9}\times1.0953452\times10^{9}-1.3141745\times10^{27} -121\times1.1997811 \times10^{18}-2)+5.5\times1.4394748\times10^{36}+\frac{77617.0}{66192}\\ \textcolor{blue}{\approx}\, 4.3860574\times10^{29}+6.0243987\times10^{9}\times(6.6268386\times10^{10}\times1.0953452\times10^{9}-1.3141745\times10^{27}-1.4517351\times10^{20}-2) +7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx} \,4.3860574\times10^{29}+6.0243987\times10^{9}\times(7.2586759\times10^{19}-1.3141745\times10^{27}-1.4517351\times10^{20} -2)+7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx} \,4.3860574\times10^{29}+6.0243987\times10^{9}\times(-1.3141744\times10^{27}-1.4517351\times10^{20}-2) +7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx}\, 4.3860574\times10^{29}+6.0243987\times10^{9}\times(-1.3141745\times10^{27}-2)+7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx} \,4.3860574\times10^{29}+6.0243987\times10^{9}\times(-1.3141745\times10^{27})+7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx}\, 4.3860574\times10^{29}-7.9171111\times10^{36}+7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{\approx}-7.9171107\times10^{36}+7.9171114\times10^{36}+1.1726039\\ \textcolor{blue}{=} \,7.0000000\times10^{29}+1.1726039\\ \textcolor{blue}{\approx}\,\textcolor{red}{7.0000000\times10^{29}}\,;

       保留 16位有效数字,则计算过程与结果又如下:

333.75\times33096.0^6+77617.0^2\times(11\times77617.0^2\times33096.0^2-33096.0^6-121\times33096.0^4-2) +5.5\times33096.0^8+\frac{77617.0}{2\times33096.0}\\ \textcolor{blue}{\approx}\, 333.75\times1.314174534371215\times10^{27}+6024398689\times(11\times6024398689\times1095345216-1.314174534371215\times10^{27}-121 \times1.199781142214087\times10^{18}-2) +5.5\times1.439474789212538\times10^{36}+\frac{77617.0}{66192}\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}+6024398689\times(66268385579\times1095345216-1.314174534371215\times10^{27}-1.451735182079045\times10^{20} -2)+7.917111340668959\times10^{36}+1.172603940053179\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}+6024398689\times(7.258675911600104\times10^{19}-1.314174534371215\times10^{27}-1.451735182079045\times10^{20} -2)+7.917111340668959\times10^{36}+1.172603940053179\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}+6024398689\times(-1.314174461784456\times10^{27}-1.451735182079045\times10^{20}-2)+7.917111340668959 \times10^{36}+1.172603940053179\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}+6024398689\times(-1.314174606957974\times10^{27}-2) +7.917111340668959\times10^{36}+1.172603940053179\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}+6024398689\times(-1.314174606957974\times10^{27}) +7.917111340668959\times10^{36}+1.172603940053179\\ \textcolor{blue}{\approx}\, 4.386057508463930\times10^{29}-7.917111779274709\times10^{36}+7.917111340668959\times10^{36} +1.172603940053179\\ \textcolor{blue}{\approx}\, -7.917111340668958\times10^{36}+7.917111340668959\times10^{36}+1.172603940053179\\ \textcolor{blue}{=}\, 1.000000000000000\times10^{21}+1.172603940053179\\ \textcolor{blue}{\approx}\, \textcolor{red}{1.000000000000000\times10^{21}}\,.

        这样,在十进制下,人类输出了错误结果。对照此结果,我们或许也能理解 Sun计算机的输出了。这时,你还能说,Sun机器的输出不对吗?它是按照人类的指令运行的!它没有违背人类的指令。只不过是人类的指令错了。它输出的是“正确”的结果,虽然该结果是错误结果。

  • 25
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值