diff options
author | Matthew Brett <matthew.brett@gmail.com> | 2017-02-21 15:47:28 -0800 |
---|---|---|
committer | Matthew Brett <matthew.brett@gmail.com> | 2017-02-21 17:14:57 -0800 |
commit | 78df10f58d8963829865515f98695f04a1f76e00 (patch) | |
tree | ffce21732a8c7a2368ccfbb66baf0240ad1b2671 /numpy | |
parent | 9df4a528b57d0d95d84132394178e65ba2683159 (diff) | |
download | numpy-78df10f58d8963829865515f98695f04a1f76e00.tar.gz |
TST: add tests of nextafter around 0
Check that nextafter(0) gives number in range ]0 ... tiny[, and number
divided by 2 is 0 (denormal).
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/tests/test_umath.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index d83b7dccd..daca67150 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -2126,6 +2126,12 @@ def test_nextafterf(): def test_nextafterl(): return _test_nextafter(np.longdouble) +def test_nextafter_0(): + for t, direction in itertools.product(np.sctypes['float'], (1, -1)): + tiny = np.finfo(t).tiny + assert_(0. < direction * np.nextafter(t(0), t(direction)) < tiny) + assert_equal(np.nextafter(t(0), t(direction)) / t(2.1), direction * 0.0) + def _test_spacing(t): one = t(1) eps = np.finfo(t).eps |