-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
math.tan has poor accuracy near pi/2 on OS X Tiger #72140
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
Comments
Opening this for the record; I intend to close as "wont fix". The tan function has poor accuracy for inputs near pi/2 on OS X 10.4. This is a direct consequence of a poor libm implementation, so there's little we can do about it short of re-implenting tan ourselves. 10.4 is ancient enough by now that it's difficult to care too much. Example failures: ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_math.py", line 1190, in test_testfile
'\n '.join(failures))
AssertionError: Failures in test_testfile:
tan0064: tan(1.5707963267948961): expected 1978937966095219.0, got 1978945885716843.0 (error = 7.92e+09 (31678486496 ulps); permitted error = 0 or 5 ulps) and a corresponding failure in cmath: ====================================================================== Traceback (most recent call last):
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", line 398, in test_specific_values
msg=error_message)
File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", line 147, in rAssertAlmostEqual
'{!r} and {!r} are not sufficiently close'.format(a, b))
AssertionError: tan0064: tan(complex(1.5707963267948961, 0.0))
Expected: complex(1978937966095219.0, 0.0)
Received: complex(1978945885716843.0, 0.0)
Received value insufficiently close to expected value. |
New changeset b4d52df5595e by Mark Dickinson in branch 'default': |
The relevant tests are now skipped on OS X < 10.5, and test_math and test_cmath are passing on the OS X Tiger buildbot. Closing (as "wont fix", since we haven't actually fixed the underlying issue). |
It would be nice to use the existing @requires_mac_ver() decorator to skip the tests (see Lib/test/support/init.py). |
Ned: that's for skipping an entire test method, right? Here a single test method tests a few hundred different special cases; we want to exclude only one of those cases. |
Mark, ah, yes, that's true. So the tests would have to be separated out into a separate test case method. So, not worth the effort. |
Given enough time, it would make a lot of sense to adapt these tests to use the subtests machinery (though it's not immediately clear to me how to make @requires_mac_ver work with the subtests machinery). I'm afraid this issue was a bit of a quick fix to get the buildbots back to working state. |
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: