bpo-33089: Multidimensional math.hypot() by rhettinger · Pull Request #8474 · python/cpython (original) (raw)

This makes me nervous, because it depends on that

12 * math.sqrt(1 + (5/12)**2)

happens to be exactly 13.0 despite that 5/12 isn't exactly representable. Would be happier with:

self.assertEqual(math.hypot(4*scale, 3*scale), 5*scale)

because every intermediate value in

4 * math.sqrt(1 + (3/4)**2)

is exactly representable in binary.