本文介绍了浮点加法中的错误:是否有其他人看到这个?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SuSE 10.2 / Xeon上,似乎有一个四舍五入的错误,即

浮点数增加:


dickinsm @ weyl:~python

Python 2.5(r25:51908,2007年5月25日,16:14:04)

[gCC 4.1.2 20061115(预发布)(SUSE Linux)] on linux2

输入help,copyright,credit等等。或许可证或欲获得更多信息。



9999999999999998.0



9999999999999998.0



10000000000000000.0


这里的最后一个结果应该是9999999999999998.0,

不是10000000000000000.0。有没有人看到这个

的错误,还是只是我系统的怪癖?


Mark

解决方案



9999999999999998.0



9999999999999998.0



10000000000000000.0


这里的最后一个结果应该是9999999999999998.0,

not not 10000000000000000.0。是否有其他人看到这个

错误,还是只是我系统的怪癖?



它在OSX下工作:


(TG1044)mac-dir:〜/ projects / artnology / Van_Abbe_RMS / Van -Abbe-RMS deets




9999999999999998.0



9999999999999998.0



但在linux下,我得到了同样的行为:


Python 2.5.1 (r251:54863,2007年5月2日,16:56:35)

[GCC 4.1.2(Ubuntu 4.1.2-0ubuntu4)] on linux2

类型"帮助,版权,信用或许可证或欲了解更多信息。

欢迎来到rlcompleter2 0.96

获得不错的体验< tabmultiple times



10000000000000000.0



所以 - 在我看来它是一个Linux的东西。我不太了解

IEEE-floats对原因做出任何假设。


Diez




9999999999999998.0



9999999999999998.0



10000000000000000.0


这里的最后一个结果应该是9999999999999998.0,

not not 10000000000000000.0。有没有人看到这个

的错误,还是只是我系统的怪癖?


Mark



我也看到了


On SuSE 10.2/Xeon there seems to be a rounding bug for
floating-point addition:

dickinsm@weyl:~python
Python 2.5 (r25:51908, May 25 2007, 16:14:04)
[GCC 4.1.2 20061115 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

9999999999999998.0

9999999999999998.0

10000000000000000.0

The last result here should be 9999999999999998.0,
not 10000000000000000.0. Is anyone else seeing this
bug, or is it just a quirk of my system?

Mark

解决方案

9999999999999998.0

9999999999999998.0

10000000000000000.0

The last result here should be 9999999999999998.0,
not 10000000000000000.0. Is anyone else seeing this
bug, or is it just a quirk of my system?

It is working under OSX:

(TG1044)mac-dir:~/projects/artnology/Van_Abbe_RMS/Van-Abbe-RMS deets


9999999999999998.0

9999999999999998.0

But under linux, I get the same behavior:

Python 2.5.1 (r251:54863, May 2 2007, 16:56:35)
[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Welcome to rlcompleter2 0.96
for nice experiences hit <tabmultiple times

10000000000000000.0


So - seems to me it''s a linux-thing. I don''t know enough about
IEEE-floats to make any assumptions on the reasons for that.

Diez


9999999999999998.0

9999999999999998.0


10000000000000000.0

The last result here should be 9999999999999998.0,
not 10000000000000000.0. Is anyone else seeing this
bug, or is it just a quirk of my system?

Mark

I see it too


这篇关于浮点加法中的错误:是否有其他人看到这个?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 12:41