gh-123836: check zero signs in math_testcases.txt#123854
gh-123836: check zero signs in math_testcases.txt#123854vstinner merged 2 commits intopython:mainfrom
Conversation
Just like cmath_testcases.txt. These tests require IEEE 754 anyway.
This comment was marked as outdated.
This comment was marked as outdated.
|
CC @picnixz |
|
Sorry Sergey for not replying to your pings. I see them but I'm either doing something else or then I forget about them :( |
|
Merged, thanks. |
|
Thanks @skirpichev for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @skirpichev for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12. |
) Just like cmath_testcases.txt. These tests require IEEE 754 anyway. Correct zero sign for sqrt tests to match math.h convention. (cherry picked from commit 28aea5d) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
GH-124161 is a backport of this pull request to the 3.13 branch. |
) Just like cmath_testcases.txt. These tests require IEEE 754 anyway. Correct zero sign for sqrt tests to match math.h convention. (cherry picked from commit 28aea5d) Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
|
GH-124162 is a backport of this pull request to the 3.12 branch. |
|
|
Oh, a test failed on Windows 10: |
|
@skirpichev: Would you mind to have a look at the testFmod() failure? |
|
It's easy: windows=>bugs. Standard says: "The fmod functions compute the floating-point remainder of x/y. [...] if y is nonzero, the result has the same sign as x [...]". Does it fail on 11? Maybe it's fixed? Anyway, I'll provide patch to filter out this on Win 10. |
Is it possible to fix fmod() bug on Windows? |
|
Unfortunately, I can only guess how it's broken. Assuming that it's wrong only for signed zero as result, we could replace one with static double
m_fmod(double x, double y)
{
double r = fmod(x, y);
if (r == 0.0 && y != 0.0) {
r = copysign(r, x);
}
return r;
} |
The test pass on [MSC v.1941 64 bit (AMD64)] (Windows 10 buildbot), but fails on [MSC v.1916 64 bit (AMD64)] (GitHub Actions). It's more a matter of the C Compiler version (MSC). |
Just like cmath_testcases.txt. These tests require IEEE 754 anyway. Correct zero sign for sqrt tests to match math.h convention.
Just like cmath_testcases.txt. These tests require IEEE 754 anyway.