_hypot, hypotf
Visual Studio 2008
Calculates the hypotenuse.
double _hypot( double x, double y ); float _hypotf( float x, float y );
_hypot returns the length of the hypotenuse if successful or INF (infinity) on overflow. The errno variable is set to ERANGE on overflow. You can modify error handling with _matherr.
For more information about this and other return codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.
Routine | Required header |
|---|---|
_hypot | <math.h> |
hypotf | <math.h> |
For more compatibility information, see Compatibility in the Introduction.
// crt_hypot.c
// This program prints the hypotenuse of a right triangle.
#include <math.h>
#include <stdio.h>
int main( void )
{
double x = 3.0, y = 4.0;
printf( "If a right triangle has sides %2.1f and %2.1f, "
"its hypotenuse is %2.1f\n", x, y, _hypot( x, y ) );
}
Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.