[Previous]
[Contents]
[Next]

hypot()

calculate the length of the hypotenuse of a right-angled triangle

Synopsis:

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

Description:

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 may cause an overflow, in which case the matherr() function will be invoked.

Returns:

The value of the hypotenuse.

Examples:

#include <stdio.h>
#include <math.h>

void main()
  {
    printf( "%f\n", hypot( 3.0, 4.0 ) );
  }

produces the output:

5.000000

Classification:

WATCOM

Safety:
Interrupt handler No
Signal handler No
Thread Yes

See also:

matherr


[Previous]
[Contents]
[Next]