Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Mathematical Library Functionshypot(3M)


NAME

 hypot - Euclidean distance function

SYNOPSIS

 
cc [ flag ... ] file ... -lm [ library ... ]
#include <math.h>
double hypot(double x, double y);

DESCRIPTION

 

The hypot() function computes the length of the hypotenuse of a right-angled triangle:



 sqrt(x*x + y*y)


RETURN VALUES

 

Upon successful completion, hypot() returns the length of the hypotenuse of a right angled triangle with sides of length x and y.

If the result would cause overflow, HUGE_VAL is returned and errno may be set to ERANGE.

If x or y is NaN, NaN is returned.

ERRORS

 

The hypot() function may fail if:

ERANGE
The result overflows.

USAGE

 

The hypot() function takes precautions against underflow and overflow during intermediate steps of the computation.

An application wishing to check for error situations should set errno to 0 before calling hypot(). If errno is non-zero on return, or the return value is HUGE_VAL or NaN, an error has occurred.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

isnan(3M), sqrt(3M), attributes(5)


SunOS 5.9Go To TopLast Changed 26 Jul 2001

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.