summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorRaghuveer Devulapalli <raghuveer.devulapalli@intel.com>2021-05-05 14:51:54 -0700
committerRaghuveer Devulapalli <raghuveer.devulapalli@intel.com>2021-05-05 14:51:54 -0700
commitbf531216d3b70f28c462e457dcda1795a3c28476 (patch)
tree619e85251256eecc20f9a30449a6134fa27fb1cd /numpy
parent7ae04a19216c352ee53188fed0b39cd63468caf3 (diff)
downloadnumpy-bf531216d3b70f28c462e457dcda1795a3c28476.tar.gz
TST: Add test to verify underflow flag is raised for np.exp
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/tests/test_umath.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py
index 75e1c99d3..572e736a0 100644
--- a/numpy/core/tests/test_umath.py
+++ b/numpy/core/tests/test_umath.py
@@ -919,6 +919,12 @@ class TestSpecialFloats:
assert_raises(FloatingPointError, np.exp, np.float64(800.))
assert_raises(FloatingPointError, np.exp, np.float64(1E19))
+ with np.errstate(under='raise'):
+ assert_raises(FloatingPointError, np.exp, np.float32(-1000.))
+ assert_raises(FloatingPointError, np.exp, np.float32(-1E19))
+ assert_raises(FloatingPointError, np.exp, np.float64(-1000.))
+ assert_raises(FloatingPointError, np.exp, np.float64(-1E19))
+
def test_log_values(self):
with np.errstate(all='ignore'):
x = [np.nan, np.nan, np.inf, np.nan, -np.inf, np.nan]