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

Method test_float32_pass

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

Source from the content-addressed store, hash-verified

978 assert_array_max_ulp(nan1_f64, nan2_f64, 0)
979
980 def test_float32_pass(self):
981 nulp = 5
982 x = np.linspace(-20, 20, 50, dtype=np.float32)
983 x = 10**x
984 x = np.r_[-x, x]
985
986 eps = np.finfo(x.dtype).eps
987 y = x + x*eps*nulp/2.
988 assert_array_almost_equal_nulp(x, y, nulp)
989
990 epsneg = np.finfo(x.dtype).epsneg
991 y = x - x*epsneg*nulp/2.
992 assert_array_almost_equal_nulp(x, y, nulp)
993
994 def test_float32_fail(self):
995 nulp = 5

Callers

nothing calls this directly

Calls 2

linspaceMethod · 0.80

Tested by

no test coverage detected