bpo-41513: Improve speed and accuracy of math.hypot() (GH-21803)
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index e06b1e6..4d62eb1 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -795,7 +795,8 @@
# Verify scaling for extremely large values
fourthmax = FLOAT_MAX / 4.0
for n in range(32):
- self.assertEqual(hypot(*([fourthmax]*n)), fourthmax * math.sqrt(n))
+ self.assertTrue(math.isclose(hypot(*([fourthmax]*n)),
+ fourthmax * math.sqrt(n)))
# Verify scaling for extremely small values
for exp in range(32):
@@ -904,8 +905,8 @@
for n in range(32):
p = (fourthmax,) * n
q = (0.0,) * n
- self.assertEqual(dist(p, q), fourthmax * math.sqrt(n))
- self.assertEqual(dist(q, p), fourthmax * math.sqrt(n))
+ self.assertTrue(math.isclose(dist(p, q), fourthmax * math.sqrt(n)))
+ self.assertTrue(math.isclose(dist(q, p), fourthmax * math.sqrt(n)))
# Verify scaling for extremely small values
for exp in range(32):