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

Method test_float32_pass

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

Source from the content-addressed store, hash-verified

1449 assert_array_max_ulp(nan1_f64, nan2_f64, 0)
1450
1451 def test_float32_pass(self):
1452 nulp = 5
1453 x = np.linspace(-20, 20, 50, dtype=np.float32)
1454 x = 10**x
1455 x = np.r_[-x, x]
1456
1457 eps = np.finfo(x.dtype).eps
1458 y = x + x * eps * nulp / 2.
1459 assert_array_almost_equal_nulp(x, y, nulp)
1460
1461 epsneg = np.finfo(x.dtype).epsneg
1462 y = x - x * epsneg * nulp / 2.
1463 assert_array_almost_equal_nulp(x, y, nulp)
1464
1465 def test_float32_fail(self):
1466 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected