Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C - <b>hypot() calculate the hypotenuse of a right triangle</b> http://www.X-Hacker.org [<<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()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson