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

Method test_float16_pass

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

Source from the content-addressed store, hash-verified

1490 assert_array_max_ulp(nan1_f32, nan2_f32, 0)
1491
1492 def test_float16_pass(self):
1493 nulp = 5
1494 x = np.linspace(-4, 4, 10, dtype=np.float16)
1495 x = 10**x
1496 x = np.r_[-x, x]
1497
1498 eps = np.finfo(x.dtype).eps
1499 y = x + x * eps * nulp / 2.
1500 assert_array_almost_equal_nulp(x, y, nulp)
1501
1502 epsneg = np.finfo(x.dtype).epsneg
1503 y = x - x * epsneg * nulp / 2.
1504 assert_array_almost_equal_nulp(x, y, nulp)
1505
1506 def test_float16_fail(self):
1507 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected