(self)
| 933 | class TestArrayAlmostEqualNulp: |
| 934 | |
| 935 | def test_float64_pass(self): |
| 936 | # The number of units of least precision |
| 937 | # In this case, use a few places above the lowest level (ie nulp=1) |
| 938 | nulp = 5 |
| 939 | x = np.linspace(-20, 20, 50, dtype=np.float64) |
| 940 | x = 10**x |
| 941 | x = np.r_[-x, x] |
| 942 | |
| 943 | # Addition |
| 944 | eps = np.finfo(x.dtype).eps |
| 945 | y = x + x*eps*nulp/2. |
| 946 | assert_array_almost_equal_nulp(x, y, nulp) |
| 947 | |
| 948 | # Subtraction |
| 949 | epsneg = np.finfo(x.dtype).epsneg |
| 950 | y = x - x*epsneg*nulp/2. |
| 951 | assert_array_almost_equal_nulp(x, y, nulp) |
| 952 | |
| 953 | def test_float64_fail(self): |
| 954 | nulp = 5 |
nothing calls this directly
no test coverage detected