Bug in floating-point addition: is anyone else seeing this?

Mark Dickinson dickinsm at gmail.com
Wed May 21 16:20:38 EDT 2008


On May 21, 3:22 pm, Marc Christiansen <use... at solar-empire.de> wrote:
> On my system, it works:
>
>  Python 2.5.2 (r252:60911, May 21 2008, 18:49:26)
>  [GCC 4.1.2 (Gentoo 4.1.2 p1.0.2)] on linux2
>  Type "help", "copyright", "credits" or "license" for more information.
>  >>> a = 1e16 - 2.; a
>  9999999999999998.0
>  >>> a + 0.9999
>  9999999999999998.0
>
> Marc

Thanks for all the replies! It's good to know that it's not just
me. :-)

After a bit (well, quite a lot) of Googling, it looks as though this
might be known problem with gcc on older Intel processors: those using
an x87-style FPU instead of SSE2 for floating-point.  This gcc
'bug' looks relevant:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323

Now that I've got confirmation I'll open a Python bug report:  it's
not clear how to fix this, or whether it's worth fixing, but it
seems like something that should be documented somewhere...

Thanks again, everyone!

Mark



More information about the Python-list mailing list