data-apis / array-api-tests

Test suite for the PyData Array APIs standard
https://data-apis.org/array-api-tests/
MIT License
63 stars 39 forks source link

Fix special case testing signbit on NaNs #253

Closed honno closed 5 months ago

honno commented 5 months ago

Resolves #250

oleksandr-pavlyk commented 5 months ago

@honno Thank you for the fix. I can confirm that the test_special_cases.py::test_unary now no longer fails in dpctl.

Now that file only fails here:

FAILED array_api_tests/test_special_cases.py::test_binary[copysign(x2_i < 0) -> NaN] - AssertionError: out=-0.0, but should be NaN [copysign()]
FAILED array_api_tests/test_special_cases.py::test_binary[copysign(x2_i is -0) -> NaN] - AssertionError: out=-0.0, but should be NaN [copysign()]
FAILED array_api_tests/test_special_cases.py::test_binary[copysign(x2_i is +0) -> NaN] - AssertionError: out=0.0, but should be NaN [copysign()]
FAILED array_api_tests/test_special_cases.py::test_binary[copysign(x2_i > 0) -> NaN] - AssertionError: out=0.0, but should be NaN [copysign()]
FAILED array_api_tests/test_special_cases.py::test_nan_propagation[cumulative_sum] - AssertionError: out.shape=(1,), but should be () [cumulative_sum()]

The copysign failures may be due to a similar issue, although I have not yet investigated in earnest.

asmeurer commented 4 months ago

BTW, float('nan') always has positive sign (see https://github.com/data-apis/array-api/pull/693#issuecomment-2067594603).