Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-123836: workaround fmod(x, y) bug on Windows#124171
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):FAIL: testFmod (test.test_math.MathTests.testFmod)----------------------------------------------------------------------Traceback (most recent call last): File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest self.fail("{}: {}".format(name, failure)) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)Here Windows loose sign of the result; if y is nonzero, the resultshould have the same sign as x.This amends28aea5d.skirpichev commentedSep 17, 2024
There are few other places in the math module, where fmod() is used. I kept library function: this bug shouldn't affect mentioned cases. |
Uh oh!
There was an error while loading.Please reload this page.
Modules/_math.h Outdated
| */ | ||
| doubler=fmod(x,y); | ||
| if (r==0.0&&y!=0.0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can you make this code specific to Windows? For example, use#ifdef _MSC_VER. Move the comment on this part of the code in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do we sure that this issue specific only for Windows?
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
vstinner left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
Thanks@skirpichev for the PR, and@vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13. |
Sorry,@skirpichev and@vstinner, I could not cleanly backport this to |
Sorry,@skirpichev and@vstinner, I could not cleanly backport this to |
vstinner commentedSep 17, 2024
@skirpichev: You closed the PR, but automated backport failed. Would you mind to try to backport manually the fix to the 3.13 branch? Maybe from there, we can automate the backport to 3.12. |
GH-124186 is a backport of this pull request to the3.12 branch. |
…H-124171)Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):FAIL: testFmod (test.test_math.MathTests.testFmod)----------------------------------------------------------------------Traceback (most recent call last): File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest self.fail("{}: {}".format(name, failure)) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)Here Windows loose sign of the result; if y is nonzero, the resultshould have the same sign as x.This amends commit28aea5d.(cherry picked from commitf4dd440)Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
GH-124187 is a backport of this pull request to the3.13 branch. |
…124186)Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):FAIL: testFmod (test.test_math.MathTests.testFmod)----------------------------------------------------------------------Traceback (most recent call last): File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest self.fail("{}: {}".format(name, failure)) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)Here Windows loose sign of the result; if y is nonzero, the resultshould have the same sign as x.This amends commit28aea5d.(cherry picked from commitf4dd440)
vstinner commentedSep 17, 2024
Thanks for the backports. |
Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):FAIL: testFmod (test.test_math.MathTests.testFmod)----------------------------------------------------------------------Traceback (most recent call last): File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest self.fail("{}: {}".format(name, failure)) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)Here Windows loose sign of the result; if y is nonzero, the resultshould have the same sign as x.This amends commit28aea5d.…124187)Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):FAIL: testFmod (test.test_math.MathTests.testFmod)----------------------------------------------------------------------Traceback (most recent call last): File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 605, in testFmod self.ftest('fmod(-10, 1)', math.fmod(-10, 1), -0.0) ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_math.py", line 258, in ftest self.fail("{}: {}".format(name, failure)) ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^AssertionError: fmod(-10, 1): expected -0.0, got 0.0 (zero has wrong sign)Here Windows loose sign of the result; if y is nonzero, the resultshould have the same sign as x.This amends commit28aea5d.(cherry picked from commitf4dd440)
Uh oh!
There was an error while loading.Please reload this page.
Buildbot failure on Windows 10 with MSC v.1916 64 bit (AMD64):
Here Windows loose sign of the result; if y is nonzero, the result should have the same sign as x.
This amends28aea5d.