(original) (raw)
changeset: 69979:1f23d63b578c user: Mark Dickinson mdickinson@enthought.com date: Mon May 09 14:02:45 2011 +0100 files: Lib/test/test_math.py description: Issue #11188: In log2 tests, create powers of 2 using ldexp(1, n) instead of the less reliable 2.0**n. diff -r 2e0d3092249b -r 1f23d63b578c Lib/test/test_math.py --- a/Lib/test/test_math.py Mon May 09 14:45:38 2011 +0200 +++ b/Lib/test/test_math.py Mon May 09 14:02:45 2011 +0100 @@ -653,8 +653,8 @@ def testLog2(self): self.assertRaises(TypeError, math.log2) # Check that we get exact equality for log2 of powers of 2. - actual = [math.log2(2.0**n) for n in range(-324, 1024)] - expected = [float(n) for n in range(-324, 1024)] + actual = [math.log2(math.ldexp(1.0, n)) for n in range(-1074, 1024)] + expected = [float(n) for n in range(-1074, 1024)] self.assertEqual(actual, expected) # Check some integer values /mdickinson@enthought.com