GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-149879: Fix test_math on Cygwin by vstinner · Pull Request #150432 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented May 25, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Skip tests which fail on Cygwin: when Python is built with newlib C library.

  • Issue: Enhance Cygwin support #149879

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-149879: Fix test_math on Cygwin
cd77dae
Skip tests which fail on Cygwin: when Python is built with newlib C
library.
@vstinner vstinner added the skip news label May 25, 2026
@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label May 25, 2026
@bedevere-app bedevere-app Bot mentioned this pull request May 25, 2026
Enhance Cygwin support #149879
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label May 25, 2026
@vstinner

vstinner commented May 25, 2026

Copy link
Copy Markdown
Member Author

On Cygwin (newlib), 3 functions are not accurate:

  • math.fma()
  • math.hypot()
  • math.log2()

test_math failures (click to unfold):

Details
======================================================================
ERROR: test_fma_infinities (test.test_math.FMATests.test_fma_infinities) (b=-1e+300)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2670, in test_fma_infinities
    self.assertEqual(math.fma(a, b, -math.inf), -math.inf)
                     ~~~~~~~~^^^^^^^^^^^^^^^^^
ValueError: invalid operation in fma

======================================================================
ERROR: test_fma_infinities (test.test_math.FMATests.test_fma_infinities) (b=1e+300)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2669, in test_fma_infinities
    self.assertEqual(math.fma(a, b, math.inf), math.inf)
                     ~~~~~~~~^^^^^^^^^^^^^^^^
ValueError: invalid operation in fma

======================================================================
ERROR: test_fma_infinities (test.test_math.FMATests.test_fma_infinities) (b=-1e+300)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2669, in test_fma_infinities
    self.assertEqual(math.fma(a, b, math.inf), math.inf)
                     ~~~~~~~~^^^^^^^^^^^^^^^^
ValueError: invalid operation in fma

======================================================================
ERROR: test_fma_infinities (test.test_math.FMATests.test_fma_infinities) (b=1e+300)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2670, in test_fma_infinities
    self.assertEqual(math.fma(a, b, -math.inf), -math.inf)
                     ~~~~~~~~^^^^^^^^^^^^^^^^^
ValueError: invalid operation in fma

======================================================================
ERROR: test_fma_overflow (test.test_math.FMATests.test_fma_overflow)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2757, in test_fma_overflow
    self.assertEqual(math.fma(a, b, -c), c)
                     ~~~~~~~~^^^^^^^^^^
OverflowError: overflow in fma

======================================================================
FAIL: test_fma_single_round (test.test_math.FMATests.test_fma_single_round)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2781, in test_fma_single_round
    self.assertEqual(math.fma(a - 1.0, a + 1.0, 1.0), a*a)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.0 != 7.888609052210118e-31

======================================================================
FAIL: test_fma_zero_result (test.test_math.FMATests.test_fma_zero_result)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2728, in test_fma_zero_result
    self.assertIsNegativeZero(math.fma(tiny, -tiny, 0.0))
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2846, in assertIsNegativeZero
    self.assertTrue(
    ~~~~~~~~~~~~~~~^
        value == 0 and math.copysign(1, value) < 0,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        msg="Expected a negative zero, got {!r}".format(value)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
AssertionError: False is not true : Expected a negative zero, got 0.0

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.694adde428b44p-1', b_hex='0x1.371b0d64caed7p-1', c_hex='0x1.f347e7b8deab8p-4', expected_hex='0x1.19f10da56c8adp-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.5506672157701096 != 0.5506672157701097

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.605401ccc6ad6p-2', b_hex='0x1.ce3a40bf56640p-2', c_hex='0x1.96e3bf7bf2e20p-2', expected_hex='0x1.1af6d8aa83101p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.5526645382065283 != 0.5526645382065284

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.e5abd653a67d4p-2', b_hex='0x1.a2e400209b3e6p-1', c_hex='0x1.a90051422ce13p-1', expected_hex='0x1.37d68cc8c0fbbp+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.2181175222512897 != 1.2181175222512894

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.f94e8efd54700p-2', b_hex='0x1.123065c812cebp-1', c_hex='0x1.458f86fb6ccd0p-1', expected_hex='0x1.ccdcee26a3ff3p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.9001230642479627 != 0.9001230642479626

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.bd926f1eedc96p-1', b_hex='0x1.eee9ca68c5740p-1', c_hex='0x1.960c703eb3298p-2', expected_hex='0x1.3cdcfb4fdb007p+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.2377469129523901 != 1.2377469129523904

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.27348350fbccdp-1', b_hex='0x1.3b073914a53f1p-1', c_hex='0x1.e300da5c2b4cbp-1', expected_hex='0x1.4c51e9a3c4e29p+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.2981248879267557 != 1.298124887926756

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.2774f00b3497bp-1', b_hex='0x1.7038ec336bff0p-2', c_hex='0x1.2f6f2ccc3576bp-1', expected_hex='0x1.99ad9f9c2688bp-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.8001527670014792 != 0.8001527670014793

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.51d5a99300e5cp-1', b_hex='0x1.5cd74abd445a1p-1', c_hex='0x1.8880ab0bbe530p-1', expected_hex='0x1.3756f96b91129p+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.2161708724607458 != 1.2161708724607456

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.73cb965b821b8p-2', b_hex='0x1.218fd3d8d5371p-1', c_hex='0x1.d1ea966a1f758p-2', expected_hex='0x1.5217b8fd90119p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.6603372392201294 != 0.6603372392201293

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.4aa98e890b046p-1', b_hex='0x1.954d85dff1041p-1', c_hex='0x1.122b59317ebdfp-1', expected_hex='0x1.0bf644b340cc5p+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.0467265069608387 != 1.0467265069608385

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.e28f29e44750fp-1', b_hex='0x1.4bcc4fdcd18fep-1', c_hex='0x1.fd47f81298259p-1', expected_hex='0x1.9b000afbc9995p+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.6054694046702922 != 1.6054694046702924

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.d2e850717fe78p-3', b_hex='0x1.1dd7531c303afp-1', c_hex='0x1.e0869746a2fc2p-2', expected_hex='0x1.316df6eb26439p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.5965420877502146 != 0.5965420877502147

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.cf89c75ee6fbap-2', b_hex='0x1.b23decdc66825p-1', c_hex='0x1.3d1fe76ac6168p-1', expected_hex='0x1.00d8ea4c12abbp+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.003309863636487 != 1.0033098636364872

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.3265ae6f05572p-2', b_hex='0x1.16d7ec285f7a2p-1', c_hex='0x1.0b8405b3827fbp-1', expected_hex='0x1.5ef33c118a001p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.6854494830522528 != 0.6854494830522527

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.c4d1bf55ec1a5p-1', b_hex='0x1.bc59618459e12p-2', c_hex='0x1.ce5b73dc1773dp-1', expected_hex='0x1.496cf6164f99bp+0')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1.2868188671560348 != 1.286818867156035

======================================================================
FAIL: test_random (test.test_math.FMATests.test_random) (a_hex='0x1.d350026ac3946p-1', b_hex='0x1.9a234e149a68cp-2', c_hex='0x1.f5467b1911fd6p-2', expected_hex='0x1.b5cee3225caa5p-1')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 2829, in test_random
    self.assertEqual(math.fma(a, b, c), expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 0.8550940494008796 != 0.8550940494008797

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.459c058e20bb7p+30', hy='0x1.993ca009b9178p+29', x=1365705059.531965, y=858231809.2153769)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1612982376.8350067 != 1612982376.8350065

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.378371ae67c0cp+30', hy='0x1.fbe6619854b4cp+29', x=1306582123.6013212, y=1065143347.0413604)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1685730463.467102 != 1685730463.4671018

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.f4cd0574fb97ap+29', hy='0x1.50fe31669340ep+30', x=1050255534.6228478, y=1413450841.6438022)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1760931563.0510736 != 1760931563.0510733

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.f84e649f1e46dp+29', hy='0x1.1fa56bef8eec4p+30', x=1057606803.8897835, y=1206475515.889573)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1604404974.460929 != 1604404974.4609292

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.2e817edd3d6fap+30', hy='0x1.eb0814f1e9602p+29', x=1268801463.3099961, y=1029767838.2389529)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1634098820.135708 != 1634098820.1357083

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.0d3a6e3d04245p+29', hy='0x1.32a62fea52352p+30', x=564612551.6270224, y=1286179834.5802808)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1404651522.739977 != 1404651522.7399766

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.888e19611bfc5p+29', hy='0x1.52b8e70b24353p+29', x=823247660.1386648, y=710352097.3926796)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1087353122.1245313 != 1087353122.124531

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.57b47b7234530p+29', hy='0x1.74e2c7040e772p+29', x=720801646.2755489, y=781998304.5070632)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1063520738.6438042 != 1063520738.6438043

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.94a8d2842a7cfp+30', hy='0x1.326a51d4d8d8ap+30', x=1697264801.0414922, y=1285198965.2117639)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 2128953777.1017494 != 2128953777.1017492

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.e930b9cd99035p+29', hy='0x1.5a1030e18dff9p+30', x=1025906489.6997133, y=1451494456.3886702)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1777447687.7070193 != 1777447687.707019

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.5c6bfbec5c4dcp+30', hy='0x1.02511184b4970p+30', x=1461387003.0901403, y=1083458657.1763573)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1819212641.3949463 != 1819212641.394946

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.282bdb82f17f3p+30', hy='0x1.640ba4c4eed3ap+30', x=1242232544.7358367, y=1493362993.2332292)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1942491885.3780012 != 1942491885.3780015

======================================================================
FAIL: testHypotAccuracy (test.test_math.MathTests.testHypotAccuracy) (hx='0x1.89d8c423ea0c6p+29', hy='0x1.d35dcfe902bc3p+29', x=825956484.4892814, y=980138493.1263355)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 983, in testHypotAccuracy
    self.assertEqual(hypot(x, y), z)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
AssertionError: 1281747081.1271062 != 1281747081.127106

======================================================================
FAIL: testLog2 (test.test_math.MathTests.testLog2)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 1257, in testLog2
    self.assertEqual(math.log2(2**1023), 1023.0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 1023.0000000000001 != 1023.0

======================================================================
FAIL: testLog2Exact (test.test_math.MathTests.testLog2Exact)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/vstinner/cpython/Lib/test/support/__init__.py", line 405, in wrapper
    return func(*args, **kw)
  File "/home/vstinner/cpython/Lib/test/test_math.py", line 1283, in testLog2Exact
    self.assertEqual(actual, expected)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
AssertionError: Lists differ: [-107[70 chars]066.0000000000002, -1065.0, -1064.0, -1063.0, [21031 chars]0001] != [-107[70 chars]066.0, -1065.0, -1064.0, -1063.0, -1062.0, -10[15515 chars]23.0]

First differing element 8:
-1066.0000000000002
-1066.0

Diff is 32075 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 89 tests in 14.300s

FAILED (failures=33, errors=5, skipped=2)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented May 25, 2026

Copy link
Copy Markdown
Member Author

cc @skirpichev

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented May 25, 2026

Copy link
Copy Markdown
Member Author

Two tests failed on "Windows (free-threading) / Build and test (x64, switch-case)" CI. They are unrelated to this change.

FAIL: test_python_legacy_windows_stdio (test.test_cmd_line.CmdLineTest.test_python_legacy_windows_stdio)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\Lib\test\test_cmd_line.py", line 1047, in test_python_legacy_windows_stdio
    self.assertEqual(p.returncode, 0)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
AssertionError: 3221225794 != 0

See issue gh-150436.


FAIL: test_generator_not_under_consumer_arithmetic (test.test_profiling.test_sampling_profiler.test_blocking.TestBlockingModeStackAccuracy.test_generator_not_under_consumer_arithmetic)
Test that fibonacci_generator doesn't appear when consume_generator does arithmetic.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\cpython\cpython\Lib\test\test_profiling\test_sampling_profiler\test_blocking.py", line 137, in test_generator_not_under_consumer_arithmetic
    self.assertEqual(invalid_stacks, 0,
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
        f"Found {invalid_stacks}/{arithmetic_samples} invalid stacks where "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"fibonacci_generator appears in the stack when consume_generator "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"is on an arithmetic line. This indicates torn/inconsistent stack "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        f"traces are being captured.")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 652 != 0 : Found 652/4321 invalid stacks where fibonacci_generator appears in the stack when consume_generator is on an arithmetic line. This indicates torn/inconsistent stack traces are being captured.

See issue gh-150429.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

cmaloney
cmaloney approved these changes May 25, 2026
View reviewed changes
@vstinner
Fix test_statistics
7e743a3
@vstinner

vstinner commented May 26, 2026

Copy link
Copy Markdown
Member Author

I updated the PR to skip also test_sqrtprod_helper_function_improved_accuracy() of test_statistics.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev reviewed May 26, 2026
View reviewed changes
Comment thread Lib/test/test_math.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_math.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/test/test_math.py
# Cases with a 1 ulp error in Python 3.7 compiled with Clang
('0x1.10e89518dca48p+29', '0x1.1970f7565b7efp+30'),
('0x1.10106eb4b44a2p+29', '0x1.ef0596cdc97f8p+29'),
('0x1.459c058e20bb7p+30', '0x1.993ca009b9178p+29'),

@skirpichev skirpichev May 26, 2026

Copy link
Copy Markdown
Member

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.

Now here is 1ulp error, indeed. Though, same looks for all other tests, unless I miss something.

It could be great if you can trace this, maybe it's some case of double rounding, that doesn't catch heuristics in HAVE_DOUBLE_ROUNDING?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner May 26, 2026

Copy link
Copy Markdown
Member Author

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.

HAVE_DOUBLE_ROUNDING is False on Cygwin. I don't know how to debug testHypotAccuracy(). It seems easier to me to just skip the test on Cygwin. I don't think that newlib is optmized for accuracy. It's a C library for embedded systems.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@skirpichev skirpichev May 26, 2026

Copy link
Copy Markdown
Member

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.

HAVE_DOUBLE_ROUNDING is False on Cygwin.

Sure, I understand :-)

I don't know how to debug testHypotAccuracy().

You may compare code flow for given inputs with some "good" platform to see when differences come to play.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner May 26, 2026

Copy link
Copy Markdown
Member Author

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.

I will pass that task to the next developer :-)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Lib/test/test_math.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

vstinner added 3 commits May 26, 2026 04:08
@vstinner
Move @skip_on_newlib to test.support
a144a7a
@vstinner
Rename test_random() to test_fma_random()
412dfa9
@vstinner
unskip testLog2()
9cb8cf5
Move tests on large integer values from testLog2() to
testLog2Exact().
@vstinner

vstinner commented May 26, 2026

Copy link
Copy Markdown
Member Author

@skirpichev: I updated the PR. Please review the updated PR.

  • Move @skip_on_newlib to test.support.
  • Rename test_random() to test_fma_random().
  • Move tests on large integer values from testLog2() to testLog2Exact().
  • Unskip testLog2().
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev approved these changes May 26, 2026
View reviewed changes
Comment thread Lib/test/support/__init__.py
Comment on lines +2810 to +2811
skip_on_newlib = unittest.skipIf(sys.platform == 'cygwin',
'the test fails on newlib C library')

@skirpichev skirpichev May 26, 2026

Copy link
Copy Markdown
Member

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.

I think you can add support for platform.libc_ver() for newlib and then redo this check. But that's for another pr.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@vstinner vstinner May 26, 2026

Copy link
Copy Markdown
Member Author

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.

Yes. I added @skip_on_newlib instead of using sys.platform == 'cygwin', so later the decorator can be updated at one place if we manage to write a better way to detect newlib C library.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner enabled auto-merge (squash) May 26, 2026 02:35
@vstinner
vstinner merged commit b87c991 into python:main May 26, 2026
49 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner deleted the test_math branch May 26, 2026 02:39
@bedevere-app bedevere-app Bot removed the awaiting core review label May 26, 2026
@vstinner vstinner mentioned this pull request May 26, 2026
gh-85989: move HAVE_DOUBLE_ROUNDING check to test.support #150219
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cmaloney cmaloney cmaloney approved these changes
@skirpichev skirpichev skirpichev approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @cmaloney @skirpichev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.