hypot
Computes the length of the hypotenuse of a right triangle whose sides are x and y adjacent to that right angle
#include <math.h> double hypot ( double x, double y);
The value of the hypotenuse is returned. When an error has occurred, errno is set.
The hypot function computes the length of the hypotenuse of a right triangle whose sides are x and y adjacent to that right angle. The calculation is equivalent to
sqrt (x*x + y*y)
The computation might cause an overflow, in which case matherr is called.
#include <math.h> #include <stdio.h> main () { printf ("%f\n", hypot (3.0, 4.0) ); }
produces the following:
5.000000