MCPcopy Index your code
hub / github.com/python/cpython / check_ok

Function check_ok

Lib/test/test_import/data/double_const.py:19–27  ·  view source on GitHub ↗
(x, x_str)

Source from the content-addressed store, hash-verified

17
18# Verify that the double x is within a few bits of eval(x_str).
19def check_ok(x, x_str):
20 assert x > 0.0
21 x2 = eval(x_str)
22 assert x2 > 0.0
23 diff = abs(x - x2)
24 # If diff is no larger than 3 ULP (wrt x2), then diff/8 is no larger
25 # than 0.375 ULP, so adding diff/8 to x2 should have no effect.
26 if x2 + (diff / 8.) != x2:
27 raise TestFailed("Manifest const %s lost too much precision " % x_str)
28
29check_ok(PI, PI_str)
30check_ok(TWOPI, TWOPI_str)

Callers 1

double_const.pyFile · 0.85

Calls 2

TestFailedClass · 0.90
absFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…