New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test_math.testFsum failure on release30-maint #49843
Comments
I started getting this in release30-maint (not in py3k). ====================================================================== Traceback (most recent call last):
File "/home/antoine/py3k/30/Lib/test/test_math.py", line 443, in testFsum
self.assertEqual(actual, expected)
AssertionError: 1.1102230246251565e-16 != 0.0 |
It only seems to happen on a 32-bit build on a 64-bit system. |
And it actually also happens in py3k (but only in 32-bit mode, too). |
Hmm. I can't reproduce this. Is this a failure that just started happening recently on this Could you attach the output of the configure script (just the |
Yikes. I can't reproduce it anymore. Perhaps "make distclean" is really |
Not noise. I'd still be interested in understanding where this is coming My best guess is that you somehow ended up in a situation where the math Explanation: the x87 FPU has problems with double rounding (because it if 1e16+2.0 != 1e16+2.9999:
return These lines are supposed to skip all these tests on platforms with the |
Found the other report of this: see bpo-3421. |
I should also have said that this would fit with the 32-bit/64-bit |
That would be the reverse, since this occurred on a 32-bit build, i.e.
Wouldn't it be a problem with stale pyc files then? The result of each 64-bit: >>> def f():
... return 1e16+2.9999
...
>>> dis.dis(f)
2 0 LOAD_CONST 3 (10000000000000002.0)
3 RETURN_VALUE
>>> zlib.crc32(marshal.dumps(f.__code__.co_consts))
2292868100 32-bit: >>> def f():
... return 1e16+2.9999
...
>>> dis.dis(f)
2 0 LOAD_CONST 3 (10000000000000004.0)
3 RETURN_VALUE
>>> zlib.crc32(marshal.dumps(f.__code__.co_consts))
103113703 |
Hah! Yes! That seems entirely likely. So what sequence of moves does one have to go through |
I suppose: first run "-m test.regrtest -v test_math" in 64-bit mode, (*) CC="gcc -m32" ./configure |
Thanks, Antoine! Yes, I can now reproduce the testFsum failure on my make distclean (the rm is necessary to avoid a 'wrong architecture' build failure). It might be worth making the tests a bit more robust here; I'll |
I think it would be sufficient to invoke the addition through a helper def add(x, y):
return x + y
if add(1e16, 2.0) != add(1e16, 2.9999):
return Also, instead of "return", you might use the new "raise |
Test fixed for 2.7, 3.1 in r71837, r71839 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: