diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-03-13 12:25:49 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 12:25:49 -0600 |
commit | a91f61a429e35a47f6faa025ceb862664dc12609 (patch) | |
tree | 72c82fdcc3d7ec9b8ca623701bbc458d356b8ce4 /numpy/testing/nose_tools/utils.py | |
parent | 07fbd1407682c6b4ac5f4f5eeb078a493b07eae9 (diff) | |
parent | 5f84b380f3708e94196582e427356cc38d76b977 (diff) | |
download | numpy-a91f61a429e35a47f6faa025ceb862664dc12609.tar.gz |
Merge pull request #10718 from AaronCritchley/tst-fixing-float16-eq
BUG: Fix bug in asserting near equality of float16 arrays.
Diffstat (limited to 'numpy/testing/nose_tools/utils.py')
-rw-r--r-- | numpy/testing/nose_tools/utils.py | 4 |
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)) |