]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-123836: workaround fmod(x, y) bug on Windows (GH-124171) (#124186)
authorSergey B Kirpichev <skirpichev@gmail.com>
Tue, 17 Sep 2024 19:44:52 +0000 (22:44 +0300)
committerGitHub <noreply@github.com>
Tue, 17 Sep 2024 19:44:52 +0000 (21:44 +0200)
commitc7a94e77bc61ed6a1ec1419748f2eaefa67e0c26
treef5d96d68c03a7059b1ae1776fca381170cce0832
parent6840b611dedd67b6dc1b7cd9b5e053cde5f30f6d
[3.12] gh-123836: workaround fmod(x, y) bug on Windows (GH-124171) (#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 result
should have the same sign as x.

This amends commit 28aea5d07d.
(cherry picked from commit f4dd4402108cc005d45acd4ca83c8530c36a93ca)
Misc/NEWS.d/next/Library/2024-09-17-18-06-42.gh-issue-124171.PHCvRJ.rst [new file with mode: 0644]
Modules/mathmodule.c