Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
skip NumPy<1.25 sincos tests that exceed ULP tolerance
Skip test_windowing and test_lift_objectmode_issue_4223 on
Linux x86_64 with NumPy<1.25, where relative ULP comparison
cannot match near-zero residuals or accumulated error.
  • Loading branch information
swap357 committed Aug 17, 2026
commit a48c0b3fad23d186f6b2fd9679790753c8799ef6
13 changes: 5 additions & 8 deletions numba/tests/test_looplifting.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ def foo(x, y):
# Ensure that is really a new overload for the lifted loop
self.assertEqual(len(lifted.signatures), 2)


# Repeated sin/cos in this loop lets NumPy<1.25 error grow past ULP tolerance.
@unittest.skipIf(numpy_sincos_low_precision,
"NumPy<1.25 sincos vs libm")
def test_lift_objectmode_issue_4223(self):
from numba import jit

Expand All @@ -551,13 +553,8 @@ def foo(a, b, c, d, x0, y0, n):
kwargs = dict(a=1.7, b=1.7, c=0.6, d=1.2, x0=0, y0=0, n=200)
got = foo(**kwargs)
expected = foo.py_func(**kwargs)
ulps = 4 if numpy_sincos_low_precision else 1
self.assertPreciseEqual(
got[0], expected[0], prec='double', ulps=ulps,
)
self.assertPreciseEqual(
got[1], expected[1], prec='double', ulps=ulps,
)
self.assertPreciseEqual(got[0], expected[0])
self.assertPreciseEqual(got[1], expected[1])
[lifted] = foo.overloads[foo.signatures[0]].lifted
self.assertEqual(len(lifted.nopython_signatures), 1)

Expand Down
8 changes: 4 additions & 4 deletions numba/tests/test_np_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5732,17 +5732,17 @@ def test_select_exception(self):
np_nbfunc(condlist, choicelist, default)
self.assertIn(expected_text, str(e.exception))

# Near-zero window endpoints differ in sign under NumPy<1.25 sincos.
@unittest.skipIf(numpy_sincos_low_precision,
"NumPy<1.25 sincos vs libm")
def test_windowing(self):
def check_window(func):
np_pyfunc = func
np_nbfunc = njit(func)
ulps = 4 if numpy_sincos_low_precision else 1

for M in [0, 1, 5, 12]:
expected = np_pyfunc(M)
got = np_nbfunc(M)
self.assertPreciseEqual(expected, got, prec='double',
ulps=ulps)
self.assertPreciseEqual(expected, got, prec='double')

for M in ['a', 1.1, 1j]:
with self.assertRaises(TypingError) as raises:
Expand Down
Loading