| |||
| Home > Floating-point Support > The math library, mathlib > Hypotenuse function (hypot) | |||
double hypot(double x, double y);
This function computes the length of the hypotenuse of a right-angled
triangle whose other two sides have length x and y.
Equivalently, it computes the length of the vector (x,y)
in Cartesian coordinates. Using hypot(x,y) is
better than sqrt(x*x+y*y) because some values
of x and y could cause x
* x + y * y to overflow even though its square root would
not.
hypot returns an ERANGE error
when the result does not fit in a double.