# hypotl Function

Calculates the square root of the sum of squared long double precision floating-point values.

Include

<math.h>

Prototype

long double hypotl(long double x, long double y);

Arguments

 x first argument, or length of one side y second argument, or length of other side

Return Value

Returns the square root of a sum of the arguments squared, being the hypotenuse of a right-angled triangle with perpendicular sides of length x and y.

Example

See the notes at the beginning of this chapter or section for information on using printf() or scanf() (and other functions reading and writing the stdin or stdout streams) in the example code.

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

int main(void)
{
long double x, y, h;

x = 1.75;
y = 2.05
h = hypotl(x, y);
printf("The hypotenuse of a right-angle triangle with other side lengths of %Lf and %Lf is %Lf\n", x, y, h);
}

Example Output

The hypotenuse of a right-angle triangle with other side lengths of 1.750000 and 2.050000 is 2.695366