hypot -- Compute the Hypotenuse function

SYNOPSIS

 #include <lcmath.h>

 double hypot(double x,double y);
 

DESCRIPTION

hypot computes the square root of the sum of squares of its two arguments. The value returned by hypot is defined by this equation:

RETURN VALUE

hypot returns the square root of the sum of the squares of its arguments.

DIAGNOSTICS

The run-time library writes an error message to the standard error file (stderr) if the result of the computation would be larger than HUGE_VAL. In this case, the function returns HUGE_VAL, the largest positive floating-point number that can be represented.

If an error occurs in hypot, the _matherr routine is called. You can supply your own version of _matherr to suppress the diagnostic message or modify the value returned.

PORTABILITY

hypot is portable to many, but not all, non UNIX C implementations.

EXAMPLE

  #include <stdio.h>
  #include <lcmath.h>

  #define SVECTOR .7854

  main()
  {
     double hypov;
     hypov = hypot(SVECTOR,-SVECTOR);
     printf("hypot(%f,%f) = %f n", SVECTOR,-SVECTOR, hypov);
  }

 

RELATED FUNCTIONS

_matherr

SEE ALSO

Mathematical Functions

Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.