hypot(3) CLIX hypot(3)
NAME
hypot - Euclidean distance function
LIBRARY
Standard Math Library (libm.a)
Intergraph Math Library (libmath.a)
SYNOPSIS
#include <math.h>
double hypot(
double x, y );
PARAMETERS
x Length of one leg of the right triangle whose hypotenuse will be
computed.
y Length of the other leg of the triangle.
DESCRIPTION
The hypot() function returns the length of the hypotenuse of the right
triangle with legs x and y. This is computed by the following formula:
sqrt(x * x + y * y),
Precautions are taken against unwarranted overflows.
Programs using this function must be compiled with the -lm flag to the cc
command to include the math libraries.
EXAMPLES
double get_hypo (x,y)
double x,y;
{
/* get the hypot and return it
to the calling function */
return (hypot(x,y));
}
RETURN VALUES
If the correct values would overflow a double, HUGE is returned and errno
is set to ERANGE, otherwise the value of the length of the hypotenuse is
2/94 - Intergraph Corporation 1
hypot(3) CLIX hypot(3)
returned.
ERRORS
When the correct value overflows, the hypot() function returns HUGE and
sets errno to ERANGE.
These error-handling procedures may be changed with the matherr()
function.
RELATED INFORMATION
Function: matherr(3)
2 Intergraph Corporation - 2/94