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

Method test_dunder_round_accuracy

numpy/core/tests/test_numeric.py:202–213  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

200 assert_equal(round(val, ndigits), round(np.int32(val), ndigits))
201
202 def test_dunder_round_accuracy(self):
203 f = np.float64(5.1 * 10**73)
204 assert_(isinstance(round(f, -73), np.float64))
205 assert_array_max_ulp(round(f, -73), 5.0 * 10**73)
206 assert_(isinstance(round(f, ndigits=-73), np.float64))
207 assert_array_max_ulp(round(f, ndigits=-73), 5.0 * 10**73)
208
209 i = np.int64(501)
210 assert_(isinstance(round(i, -2), np.int64))
211 assert_array_max_ulp(round(i, -2), 500)
212 assert_(isinstance(round(i, ndigits=-2), np.int64))
213 assert_array_max_ulp(round(i, ndigits=-2), 500)
214
215 @pytest.mark.xfail(raises=AssertionError, reason="gh-15896")
216 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