PyDocs

Nav

Numeric and Mathematical Modules

hypot

math

function
  • hypot(*coordinates)
Multidimensional Euclidean distance from the origin to a point.

Roughly equivalent to:
    sqrt(sum(x**2 for x in coordinates))

For a two dimensional point (x, y), gives the hypotenuse
using the Pythagorean theorem:  sqrt(x*x + y*y).

For example, the hypotenuse of a 3/4/5 right triangle is:

    >>> hypot(3.0, 4.0)
    5.0
Changed in 3.8, 3.10
  • 3.8: Added support for n-dimensional points. Formerly, only the two dimensional case was supported.
  • 3.10: Improved the algorithm’s accuracy so that the maximum error is under 1 ulp (unit in the last place). More typically, the result is almost always correctly rounded to within 1/2 ulp.
0 Examples
No examples for math/hypot.
See Also
No see-alsos for math/hypot
0 Notes
No notes for hypot