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

Method test_dunder_round_accuracy

numpy/_core/tests/test_numeric.py:258–269  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

256 assert_equal(round(val, ndigits), round(np.int32(val), ndigits))
257
258 def test_dunder_round_accuracy(self):
259 f = np.float64(5.1 * 10**73)
260 assert_(isinstance(round(f, -73), np.float64))
261 assert_array_max_ulp(round(f, -73), 5.0 * 10**73)
262 assert_(isinstance(round(f, ndigits=-73), np.float64))
263 assert_array_max_ulp(round(f, ndigits=-73), 5.0 * 10**73)
264
265 i = np.int64(501)
266 assert_(isinstance(round(i, -2), np.int64))
267 assert_array_max_ulp(round(i, -2), 500)
268 assert_(isinstance(round(i, ndigits=-2), np.int64))
269 assert_array_max_ulp(round(i, ndigits=-2), 500)
270
271 @pytest.mark.xfail(raises=AssertionError, reason="gh-15896")
272 def test_round_py_consistency(self):

Callers

nothing calls this directly

Calls 3

assert_Function · 0.90
assert_array_max_ulpFunction · 0.90
roundFunction · 0.50

Tested by

no test coverage detected