From d6997779c47c3ea56df71cdabfea9f425b2ed3a7 Mon Sep 17 00:00:00 2001 From: Pauli Virtanen Date: Fri, 13 Nov 2009 19:18:10 +0000 Subject: BUG: use %g format in assert_array_*_nulp (fix #1297, thanks to Neil Muller) --- numpy/testing/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'numpy/testing') diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 7009d532c..708293a35 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -1109,7 +1109,7 @@ def assert_array_almost_equal_nulp(x, y, nulp=1): if not np.all(np.abs(x-y) <= ref): max_nulp = np.max(nulp_diff(x, y)) raise AssertionError("X and Y are not equal to %d ULP "\ - "(max is %d)" % (nulp, max_nulp)) + "(max is %g)" % (nulp, max_nulp)) def assert_array_max_ulp(a, b, maxulp=1, dtype=None): """Given two arrays a and b, check that every item differs in at most N @@ -1117,7 +1117,7 @@ def assert_array_max_ulp(a, b, maxulp=1, dtype=None): import numpy as np ret = nulp_diff(a, b, dtype) if not np.all(ret <= maxulp): - raise AssertionError("Arrays are not almost equal up to %d ULP" % \ + raise AssertionError("Arrays are not almost equal up to %g ULP" % \ maxulp) return ret -- cgit v1.2.1