Skip to content
Merged
Changes from all commits
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
23 changes: 23 additions & 0 deletions dpnp/tests/test_binary_ufuncs.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
has_support_aspect16,
numpy_version,
)
from .third_party.cupy import testing

"""
The scope includes tests with only functions which are instances of
Expand Down Expand Up @@ -672,6 +673,28 @@ def test_float(self, val1, val2, dt):
expected = numpy.nextafter(v1, v2)
assert_equal(result, expected)

@testing.with_requires("numpy>=2.5")
@pytest.mark.parametrize(
"zero1, zero2",
[
pytest.param(+0.0, -0.0, id="pos to neg zero"),
pytest.param(-0.0, +0.0, id="neg to pos zero"),
pytest.param(+0.0, +0.0, id="pos to pos zero"),
pytest.param(-0.0, -0.0, id="neg to neg zero"),
],
)
@pytest.mark.parametrize("dt", get_float_dtypes(no_float16=False))
def test_signed_zero(self, zero1, zero2, dt):
z1 = numpy.array(zero1, dtype=dt)
z2 = numpy.array(zero2, dtype=dt)
iz1, iz2 = dpnp.array(z1), dpnp.array(z2)

result = dpnp.nextafter(iz1, iz2)
expected = numpy.nextafter(z1, z2)

assert_equal(result, expected)
assert_equal(dpnp.signbit(result), numpy.signbit(expected))

@pytest.mark.parametrize("dt", get_float_dtypes())
def test_float_nan(self, dt):
a = numpy.array(1, dtype=dt)
Expand Down
Loading