Skip to content

Commit 4acb885

Browse files
committed
Fix exception raised in numpy.ldexp by test_overflow
1 parent afb20b0 commit 4acb885

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/test_mathematical.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,9 @@ def test_overflow(self, max_min):
13151315

13161316
result = dpnp.ldexp(dpnp.array(2.0), exp_val)
13171317
with numpy.errstate(over="ignore"):
1318-
expected = numpy.ldexp(numpy.array(2.0), exp_val)
1318+
# we can't use here numpy.array(2.0), because NumPy 2.0 will cast
1319+
# `exp_val` to int32 dtype then and `OverflowError` will be raised
1320+
expected = numpy.ldexp(2.0, exp_val)
13191321
assert_equal(result, expected)
13201322

13211323
@pytest.mark.parametrize("val", [numpy.nan, numpy.inf, -numpy.inf])

0 commit comments

Comments
 (0)