hypot(3M)
NAME
hypot − Euclidean distance function
SYNOPSIS
cc [ flag ... ] file ... −lm [ library ... ]
#include <math.h>
double hypot(double x, double y);
DESCRIPTION
The hypot() function computes the length of the hypotenuse of a right-angled triangle:
√x∗x+y∗y
RETURN VALUES
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.
ERRORS
The hypot() function may fail if:
ERANGE The result overflows.
USAGE
The hypot() function takes precautions against underflow and overflow during intermediate steps of the computation.
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.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| MT-Level | MT-Safe |
SEE ALSO
isnan(3M), sqrt(3M), attributes(5)
SunOS 5.6 — Last change: 29 Dec 1996