From fd60d2c8c4df02d1038105fb2b215744775daa74 Mon Sep 17 00:00:00 2001 From: Aaron Critchley Date: Sat, 10 Mar 2018 01:12:42 +0100 Subject: TST: Fixing bug in assert near equality of float16 arrays (#10697) --- numpy/testing/nose_tools/utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'numpy/testing/nose_tools/utils.py') 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)) -- cgit v1.2.1