(self)
| 1404 | class 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 |
nothing calls this directly
no test coverage detected