hypot(3m) DG/UX 4.30 hypot(3m)
NAME
hypot - Euclidean distance function
SYNOPSIS
#include <math.h>
double hypot (x, y)
double x, y;
DESCRIPTION
Hypot returns
sqrt(x * x + y * y)
It takes precautions against unwarranted overflows.
DIAGNOSTICS
When the correct value would overflow, hypot returns HUGE
and sets errno to ERANGE.
You can change these error-handling procedures with the
function matherr(3M).
SEE ALSO
matherr(3M).
EXAMPLE
/* Program test for the hypot() function */
#include <stdio.h>
#include <math.h>
double atof(), x, y, z, hypot();
main(argc, argv)
int argc;
char *argv[];
{
x = atof(argv[1]);
y = atof(argv[2]);
printf("Hypotenuse = %f.\n", z = hypot(x, y));
}
A call to the program test with the numbers 3.3 and 4.4
Hypotenuse = 5.500000.
Licensed material--property of copyright holder(s) Page 1