hypot

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

Library:LibC
Classification:Other
Service:Math

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

Returns the value of the hypotenuse. 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.

See Also

sqrt