summaryrefslogtreecommitdiff
path: root/numpy/testing/utils.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2009-08-03 22:41:18 +0000
committerCharles Harris <charlesr.harris@gmail.com>2009-08-03 22:41:18 +0000
commitd5ea689ecbd3560072cc398a1962b16851bf644e (patch)
treedb857419635148842f1b12c5773153f8f0586cac /numpy/testing/utils.py
parentf0e086dbcf46c345a1a6c82ccba61bdf42237502 (diff)
downloadnumpy-d5ea689ecbd3560072cc398a1962b16851bf644e.tar.gz
Try another fix for BSD problem. This one uses numpy functions, which is
probably not the best...
Diffstat (limited to 'numpy/testing/utils.py')
-rw-r--r--numpy/testing/utils.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/numpy/testing/utils.py b/numpy/testing/utils.py
index 33f338bcc..29e78be2c 100644
--- a/numpy/testing/utils.py
+++ b/numpy/testing/utils.py
@@ -473,15 +473,14 @@ def assert_approx_equal(actual,desired,significant=7,err_msg='',verbose=True):
True
"""
- import math
- from numpy.core import abs
+ import numpy as np
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 = 0.5*(abs(desired) + abs(actual))
- scale = math.pow(10,math.floor(math.log10(scale)))
+ scale = 0.5*(np.abs(desired) + np.abs(actual))
+ scale = np.power(10,np.floor(np.log10(scale)))
try:
sc_desired = desired/scale
except ZeroDivisionError: