diff options
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r-- | numpy/testing/utils.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py index 3e1a528ec..33f338bcc 100644 --- a/numpy/testing/utils.py +++ b/numpy/testing/utils.py @@ -474,11 +474,14 @@ def assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=True): """ import math + from numpy.core import abs actual, desired = map(float, (actual, desired)) if desired==actual: return # Normalized the numbers to be in range (-10.0,10.0) - scale = float(pow(10,math.floor(math.log10(0.5*(abs(desired)+abs(actual)))))) + # scale = float(pow(10,math.floor(math.log10(0.5*(abs(desired)+abs(actual)))))) + scale = 0.5*(abs(desired) + abs(actual)) + scale = math.pow(10,math.floor(math.log10(scale))) try: sc_desired = desired/scale except ZeroDivisionError: |