www.delorie.com/djgpp/doc/libc/libc_466.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

hypot

Syntax

 
#include <math.h>

double hypot(double x, double y);

Description

This function computes sqrt(x*x + y*y), the length of a hypotenuse of a right triangle whose shorter sides are x and y. In other words, it computes the Euclidean distance between the points (0,0) and (x,y). Since the computation is done in extended precision, there is no danger of overflow or underflow when squaring the arguments, whereas direct computation of sqrt(x*x + y*y) could cause overflow or underflow for extreme (very large or very small) values of x and y.

Return Value

The value of sqrt(x*x + y*y). If both arguments are finite, but the result is so large that it would overflow a double, the return value is Inf, and errno is set to ERANGE. If one of the arguments is Inf, the return value is Inf and the value of errno is left unchanged. If one of the arguments is NaN, the return value is NaN and errno is set to EDOM.

Portability

ANSI/ISO C No
POSIX No


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004