MCPcopy Index your code
hub / github.com/numpy/numpy / test_float64_pass

Method test_float64_pass

numpy/testing/tests/test_utils.py:1406–1422  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1404class TestArrayAlmostEqualNulp:
1405
1406 def test_float64_pass(self):
1407 # The number of units of least precision
1408 # In this case, use a few places above the lowest level (ie nulp=1)
1409 nulp = 5
1410 x = np.linspace(-20, 20, 50, dtype=np.float64)
1411 x = 10**x
1412 x = np.r_[-x, x]
1413
1414 # Addition
1415 eps = np.finfo(x.dtype).eps
1416 y = x + x * eps * nulp / 2.
1417 assert_array_almost_equal_nulp(x, y, nulp)
1418
1419 # Subtraction
1420 epsneg = np.finfo(x.dtype).epsneg
1421 y = x - x * epsneg * nulp / 2.
1422 assert_array_almost_equal_nulp(x, y, nulp)
1423
1424 def test_float64_fail(self):
1425 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected