[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
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 */
}
See Also:
cabs()
matherr()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson