summaryrefslogtreecommitdiff
path: root/numpy/testing/nose_tools/utils.py
diff options
context:
space:
mode:
authorAaron Critchley <aaron.critchley@gmail.com>2018-03-10 01:12:42 +0100
committerAaron Critchley <aaron.critchley@gmail.com>2018-03-10 01:12:42 +0100
commitfd60d2c8c4df02d1038105fb2b215744775daa74 (patch)
treeeb294895184a38bda89f7264bc9a607f6d68372d /numpy/testing/nose_tools/utils.py
parentc486d8d0d496f6b366dc827a3d41ed1e9d593ec8 (diff)
downloadnumpy-fd60d2c8c4df02d1038105fb2b215744775daa74.tar.gz
TST: Fixing bug in assert near equality of float16 arrays (#10697)
Diffstat (limited to 'numpy/testing/nose_tools/utils.py')
-rw-r--r--numpy/testing/nose_tools/utils.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/testing/nose_tools/utils.py b/numpy/testing/nose_tools/utils.py
index 2d97b5c1e..ff3cf841c 100644
--- a/numpy/testing/nose_tools/utils.py
+++ b/numpy/testing/nose_tools/utils.py
@@ -1577,7 +1577,9 @@ def integer_repr(x):
"""Return the signed-magnitude interpretation of the binary representation of
x."""
import numpy as np
- if x.dtype == np.float32:
+ if x.dtype == np.float16:
+ return _integer_repr(x, np.int16, np.int16(-2**15))
+ elif x.dtype == np.float32:
return _integer_repr(x, np.int32, np.int32(-2**31))
elif x.dtype == np.float64:
return _integer_repr(x, np.int64, np.int64(-2**63))