|
8 | 8 | ) |
9 | 9 |
|
10 | 10 | from random import random |
11 | | -from math import isnan, copysign, ulp |
| 11 | +from math import isnan, copysign |
12 | 12 | import operator |
13 | 13 |
|
14 | 14 | INF = float("inf") |
@@ -517,19 +517,13 @@ def test_pow_with_small_integer_exponents(self): |
517 | 517 | self.assertNotEqual(r1.imag, 0.0) |
518 | 518 | self.assertTrue(r2.real == 0.0 or r2.imag == 0.0) |
519 | 519 |
|
520 | | - @support.requires_IEEE_754 |
521 | 520 | def test_pow_small_negative_integer_exponents(self): |
522 | | - z = complex(float.fromhex('0x1.47e9c711723f5p+81'), |
523 | | - float.fromhex('0x1.38afd1168e49fp+85')) |
524 | | - expected = complex(float.fromhex('0x0.4000000000000p-1022'), |
525 | | - float.fromhex('0x0.3ffffffffffffp-1022')) |
526 | | - for exponent in (-12, -12.0, complex(-12.0, 0.0)): |
527 | | - with self.subTest(exponent=exponent): |
528 | | - result = z ** exponent |
529 | | - self.assertLessEqual(abs(result.real - expected.real), |
530 | | - 4 * ulp(expected.real)) |
531 | | - self.assertLessEqual(abs(result.imag - expected.imag), |
532 | | - 4 * ulp(expected.imag)) |
| 521 | + for z, expected in [(complex(2**86, 0), complex(2**-1032, 0)), |
| 522 | + (complex(0, 2**86), complex(2**-1032, 0)), |
| 523 | + (complex(2**85, 2**85), complex(-2**-1026, 0))]: |
| 524 | + for exponent in (-12, -12.0, complex(-12)): |
| 525 | + with self.subTest(z=z, exponent=exponent): |
| 526 | + self.assertEqual(z**exponent, expected) |
533 | 527 |
|
534 | 528 | def test_boolcontext(self): |
535 | 529 | for i in range(100): |
|
0 commit comments