1500 characters remaining
 Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

# _hypot, hypotf

Visual Studio 2005

Calculates the hypotenuse.

```
double _hypot(
double x,
double y
);
float _hypotf(
float x,
float y
);
```

#### Parameters

x, y

Floating-point values.

## Return Value

_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.

## Platforms

_hypotf is only available on Itanium Processor Family (IPF) platforms. _hypot is available on all platforms.

## Remarks

The _hypot function calculates the length of the hypotenuse of a right triangle, given the length of the two sides x and y (in other words, the square root of x2 + y2).

## Requirements

_hypot

<math.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

hypotf

<math.h>

ANSI, Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more compatibility information, see Compatibility in the Introduction.

## Example

```// 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 ) );
}
```

#### Output

`If a right triangle has sides 3.0 and 4.0, its hypotenuse is 5.0`

## .NET Framework Equivalent

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.