(self)
| 173 | self.check_strtod(s) |
| 174 | |
| 175 | def test_boundaries(self): |
| 176 | # boundaries expressed as triples (n, e, u), where |
| 177 | # n*10**e is an approximation to the boundary value and |
| 178 | # u*10**e is 1ulp |
| 179 | boundaries = [ |
| 180 | (10000000000000000000, -19, 1110), # a power of 2 boundary (1.0) |
| 181 | (17976931348623159077, 289, 1995), # overflow boundary (2.**1024) |
| 182 | (22250738585072013831, -327, 4941), # normal/subnormal (2.**-1022) |
| 183 | (0, -327, 4941), # zero |
| 184 | ] |
| 185 | for n, e, u in boundaries: |
| 186 | for j in range(1000): |
| 187 | digits = n + random.randrange(-3*u, 3*u) |
| 188 | exponent = e |
| 189 | s = '{}e{}'.format(digits, exponent) |
| 190 | self.check_strtod(s) |
| 191 | n *= 10 |
| 192 | u *= 10 |
| 193 | e -= 1 |
| 194 | |
| 195 | def test_underflow_boundary(self): |
| 196 | # test values close to 2**-1075, the underflow boundary; similar |
nothing calls this directly
no test coverage detected