MCPcopy Create free account
hub / github.com/numpy/numpy / test_float16_pass

Method test_float16_pass

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

Source from the content-addressed store, hash-verified

1019 assert_array_max_ulp(nan1_f32, nan2_f32, 0)
1020
1021 def test_float16_pass(self):
1022 nulp = 5
1023 x = np.linspace(-4, 4, 10, dtype=np.float16)
1024 x = 10**x
1025 x = np.r_[-x, x]
1026
1027 eps = np.finfo(x.dtype).eps
1028 y = x + x*eps*nulp/2.
1029 assert_array_almost_equal_nulp(x, y, nulp)
1030
1031 epsneg = np.finfo(x.dtype).epsneg
1032 y = x - x*epsneg*nulp/2.
1033 assert_array_almost_equal_nulp(x, y, nulp)
1034
1035 def test_float16_fail(self):
1036 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected