Skip to content

Commit 316e22f

Browse files
committed
add tests and update changelog with pr
1 parent 78501a3 commit 316e22f

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1414
* Pinned Cython in the Coverity Scan workflow so generated code stays stable between scans, and added `coverity/README.md` documenting the known Cython-boilerplate false positives and the scan review checklist [gh-266](https://github.com/IntelPython/mkl_umath/pull/266)
1515

1616
### Fixed
17-
* Fixed `absolute` (float32/float64) returning `-NaN` for `+NaN` input on the scalar fallback path (same issue as numpy/numpy@dc478c58b9, gh-31433)
17+
* Fixed `absolute` (float32/float64) returning `-NaN` for `+NaN` input on the scalar fallback path (same issue as numpy/numpy@dc478c58b9, gh-31433) [gh-269](https://github.com/IntelPython/mkl_umath/pull/269)
1818
* Fixed an over-decref of the borrowed module dictionary reference on the module initialization error path [gh-264](https://github.com/IntelPython/mkl_umath/pull/264)
1919
* Fixed a leak of the module object when the NumPy C-API import fails during module initialization [gh-263](https://github.com/IntelPython/mkl_umath/pull/263)
2020

‎mkl_umath/tests/test_basic.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,3 +189,16 @@ def test_reduce_complex(func, dtype):
189189
assert np.allclose(
190190
mkl_res, np_res
191191
), f"Results for '{func}[reduce]' do not match"
192+
193+
194+
@pytest.mark.parametrize("size", [100, 8192 + 1])
195+
@pytest.mark.parametrize("dtype", [np.float32, np.float64])
196+
def test_absolute_nan_signbit(size, dtype):
197+
# size 100 takes the fallback loop, 8193 takes MKL's vAbs
198+
for nan in (np.nan, -np.nan):
199+
a = np.full(size, nan, dtype=dtype)
200+
sign = "-" if np.signbit(nan) else "+"
201+
assert not np.signbit(mu.absolute(a)).any(), (
202+
f"absolute({sign}nan) must be +nan for "
203+
f"{dtype.__name__} at size {size}"
204+
)

0 commit comments

Comments
 (0)