summaryrefslogtreecommitdiff
path: root/numpy/testing/tests/test_utils.py
diff options
context:
space:
mode:
authorDavid Cournapeau <cournape@gmail.com>2009-11-10 09:34:48 +0000
committerDavid Cournapeau <cournape@gmail.com>2009-11-10 09:34:48 +0000
commit6e3e3d4afff28305d80ca0ad4e172fbf493f5a41 (patch)
treee0392883bf80f19697ca2a575b81d90c046fbf90 /numpy/testing/tests/test_utils.py
parentcbe4c80dda4c93bd69ce7a7c4f65f21cd8e38890 (diff)
downloadnumpy-6e3e3d4afff28305d80ca0ad4e172fbf493f5a41.tar.gz
REF: move spacing tests to umath as spacing is now a ufunc.
Diffstat (limited to 'numpy/testing/tests/test_utils.py')
-rw-r--r--numpy/testing/tests/test_utils.py39
1 files changed, 0 insertions, 39 deletions
diff --git a/numpy/testing/tests/test_utils.py b/numpy/testing/tests/test_utils.py
index 8d154be82..ab314a703 100644
--- a/numpy/testing/tests/test_utils.py
+++ b/numpy/testing/tests/test_utils.py
@@ -328,45 +328,6 @@ class TestArrayAlmostEqualNulp(unittest.TestCase):
assert_array_almost_equal_nulp(x, y, nulp=1000)
self.failUnlessRaises(AssertionError, failure)
-class TestSpacing(unittest.TestCase):
- def test_one(self):
- for dt, dec in zip([np.float32, np.float64], (10, 20)):
- x = np.array(1, dtype=dt)
- # In theory, eps and spacing(1) should be exactly equal
- assert_array_almost_equal(spacing(x), np.finfo(dt).eps, decimal=dec)
-
- def test_simple(self):
- # Reference from this fortran file, built with gfortran 4.3.3 on linux
- # 32bits:
- # PROGRAM test_spacing
- # INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
- # INTEGER, PARAMETER :: DBL = SELECTED_REAL_KIND(p=13, r=200)
- #
- # WRITE(*,*) spacing(0.00001_DBL)
- # WRITE(*,*) spacing(1.0_DBL)
- # WRITE(*,*) spacing(1000._DBL)
- # WRITE(*,*) spacing(10500._DBL)
- #
- # WRITE(*,*) spacing(0.00001_SGL)
- # WRITE(*,*) spacing(1.0_SGL)
- # WRITE(*,*) spacing(1000._SGL)
- # WRITE(*,*) spacing(10500._SGL)
- # END PROGRAM
- ref = {}
- ref[np.float64] = [1.69406589450860068E-021,
- 2.22044604925031308E-016,
- 1.13686837721616030E-013,
- 1.81898940354585648E-012]
- ref[np.float32] = [
- 9.09494702E-13,
- 1.19209290E-07,
- 6.10351563E-05,
- 9.76562500E-04]
-
- for dt, dec in zip([np.float32, np.float64], (10, 20)):
- x = np.array([1e-5, 1, 1000, 10500], dtype=dt)
- assert_array_almost_equal(spacing(x), ref[dt], decimal=dec)
-
class TestULP(unittest.TestCase):
def test_equal(self):
x = np.random.randn(10)