Issue #18739: Fix inconsistent results from math.log(n) and math.log(long(n))
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index ac4475e..a8677ce 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -599,6 +599,9 @@
self.assertEqual(math.log(INF), INF)
self.assertRaises(ValueError, math.log, NINF)
self.assertTrue(math.isnan(math.log(NAN)))
+ # Log values should match for int and long (issue #18739).
+ for n in range(1, 1000):
+ self.assertEqual(math.log(n), math.log(long(n)))
def testLog1p(self):
self.assertRaises(TypeError, math.log1p)
@@ -621,6 +624,9 @@
self.assertEqual(math.log(INF), INF)
self.assertRaises(ValueError, math.log10, NINF)
self.assertTrue(math.isnan(math.log10(NAN)))
+ # Log values should match for int and long (issue #18739).
+ for n in range(1, 1000):
+ self.assertEqual(math.log10(n), math.log10(long(n)))
def testModf(self):
self.assertRaises(TypeError, math.modf)