hypot() Calculate the Hypotenuse of a Right Triangle
#include <math.h>
double hypot(x,y);
double x,y: Floating-point values
hypot() returns the length of the hypotenuse of the right triangle
with sides of length 'x' and 'y'. This is the equivalent of:
sqrt('x' * 'x' + 'y' * 'y');
Returns: The length of the hypotenuse. On overflow, matherr() is
called with an overflow error, 'errno' (defined in
<stdlib.h>) is set to ERANGE (defined in <math.h>), and
the value 'HUGE' (defined in <math.h>) is returned.
Notes: Error handling can be modified by using the matherr()
routine.
-------------------------------- Example ---------------------------------
The following statements calculate the length of the hypotenuse of a
right triangle with two sides of length 7.0 and 24.0:
#include <math.h> /* for hypot() */
main()
{
double h;
h = hypot(7.0, 24.0); /* h = 25.0 */
}
Seealso:
This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster