Partager via


_hypot (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Calculates the hypotenuse.

double _hypot(    doublex,doubley);

Parameters

  • x, y
    Floating-point values

Libraries

All versions of the C run-time libraries.

Return Values

_hypot returns the length of the hypotenuse if successful or INF (infinity) on overflow.

Remarks

The _hypot function calculates the length of the hypotenuse of a right triangle, given the length of the two sides x and y.

A call to _hypot is equivalent to the square root of x2 + y2.

Example

/* HYPOT.C: This program prints the
 * hypotenuse of a right  triangle.
 */


void 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

Requirements

OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.

See Also

_cabs

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.