hypot

Computes the length of the hypotenuse of a right triangle whose sides are x and y adjacent to that right angle

Local Servers:nonblocking
Remote Servers:N/A
Classification:Other
Service:Mathematical Computation

Syntax

  #include <math.h>  
   
  double hypot  (  
     double   x,   
     double   y);
  

Parameters

x and y
(IN) Specifies the sides of a right triangle adjacent to the right angle.

Return Values

The value of the hypotenuse is returned. When an error has occurred, errno is set.

Remarks

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.

Example

  #include <math.h>  
  #include <stdio.h>  
   
  main ()  
  {  
     printf ("%f\n", hypot (3.0, 4.0) );  
  }
  

produces the following:

  5.000000