NAME
hypot — Euclidean
distance function
SYNOPSIS
#include <math.h> double hypot(double x, double y);
DESCRIPTION
The hypot() function computes the length of the hypotenuse of a right-angled triangle:
An application wishing to check for error situations should set errno to 0 before calling hypot(). If errno is non-zero on return, or the return value is HUGE_VAL or NaN, an error has occurred.
RETURN VALUE
Upon successful completion, hypot() returns the length of the hypotenuse of a right angled triangle with sides of length x and y .
If the result would cause overflow, HUGE_VAL is returned and errno may be set to [ERANGE].
If x or y is NaN, NaN is returned. and errno may be set to [EDOM].
If the correct result would cause underflow, 0 is returned and errno may be set to [ERANGE].
ERRORS
The hypot() function may fail if:
No other errors will occur.
EXAMPLES
None.
APPLICATION USAGE
The hypot() function takes precautions against overflow during intermediate steps of the computation. If the calculated result would still overflow a double, then hypot() returns HUGE_VAL.
FUTURE DIRECTIONS
None.
SEE ALSO
DERIVATION
Derived from Issue 1 of the SVID.