()
| 79 | yield s |
| 80 | |
| 81 | def test_boundaries(): |
| 82 | # boundaries expressed as triples (n, e, u), where |
| 83 | # n*10**e is an approximation to the boundary value and |
| 84 | # u*10**e is 1ulp |
| 85 | boundaries = [ |
| 86 | (10000000000000000000, -19, 1110), # a power of 2 boundary (1.0) |
| 87 | (17976931348623159077, 289, 1995), # overflow boundary (2.**1024) |
| 88 | (22250738585072013831, -327, 4941), # normal/subnormal (2.**-1022) |
| 89 | (0, -327, 4941), # zero |
| 90 | ] |
| 91 | for n, e, u in boundaries: |
| 92 | for j in range(1000): |
| 93 | for i in range(TEST_SIZE): |
| 94 | digits = n + random.randrange(-3*u, 3*u) |
| 95 | exponent = e |
| 96 | s = '{}e{}'.format(digits, exponent) |
| 97 | yield s |
| 98 | n *= 10 |
| 99 | u *= 10 |
| 100 | e -= 1 |
| 101 | |
| 102 | def test_underflow_boundary(): |
| 103 | # test values close to 2**-1075, the underflow boundary; similar |
no test coverage detected
searching dependent graphs…