Skip to content

Commit 2db6c7b

Browse files
authoredApr 15, 2025··
Merge pull request #366 from ev-br/nextafter
ENH: test nextafter
2 parents 31eec9d + ea4185f commit 2db6c7b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
 

‎array_api_tests/test_operators_and_elementwise_functions.py

+21
Original file line numberDiff line numberDiff line change
@@ -1595,6 +1595,26 @@ def test_not_equal(ctx, data):
15951595
)
15961596

15971597

1598+
@pytest.mark.min_version("2024.12")
1599+
@given(
1600+
shapes=hh.two_mutually_broadcastable_shapes,
1601+
dtype=hh.real_floating_dtypes,
1602+
data=st.data()
1603+
)
1604+
def test_nextafter(shapes, dtype, data):
1605+
x1 = data.draw(hh.arrays(dtype=dtype, shape=shapes[0]), label="x1")
1606+
x2 = data.draw(hh.arrays(dtype=dtype, shape=shapes[0]), label="x2")
1607+
1608+
out = xp.nextafter(x1, x2)
1609+
_assert_correctness_binary(
1610+
"nextafter",
1611+
math.nextafter,
1612+
in_dtypes=[x1.dtype, x2.dtype],
1613+
in_shapes=[x1.shape, x2.shape],
1614+
in_arrs=[x1, x2],
1615+
out=out
1616+
)
1617+
15981618
@pytest.mark.parametrize("ctx", make_unary_params("positive", dh.numeric_dtypes))
15991619
@given(data=st.data())
16001620
def test_positive(ctx, data):
@@ -1813,6 +1833,7 @@ def _filter_zero(x):
18131833
("divide", operator.truediv, {"filter_": lambda s: s != 0}, None),
18141834
("hypot", math.hypot, {}, None),
18151835
("logaddexp", logaddexp_refimpl, {}, None),
1836+
("nextafter", math.nextafter, {}, None),
18161837
("maximum", max, {'strict_check': True}, None),
18171838
("minimum", min, {'strict_check': True}, None),
18181839
("multiply", operator.mul, {}, None),

0 commit comments

Comments
 (0)
Please sign in to comment.