Computes the Euclidean distance function and complex absolute value.
IEEE Math Library (libm.a)
System
V Math Library (libmsaa.a)
#include <math.h>
double hypot ( x, y)
double x, y;
float hypotf (x, y) float x; float y; long double hypotl (x, y) long double x; long double y;
The hypot, hypotf and hypotl subroutines compute the value of the square root of x2 + y2 without undue overflow or underflow.
An application wishing to check for error situations should set the errno global variable to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these subroutines. Upon return, if errno is nonzero or fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is nonzero, an error has occurred.
x | Specifies some double-precision floating-point value. |
y | Specifies some double-precision floating-point value. |
Upon successful completion, the hypot, hypotf and hypotl subroutines return the length of the hypotenuse of a right-angled triangle with sides of length x and y.
If the correct value would cause overflow, a range error occurs and the hypotf and hypotl subroutines return the value of the macro HUGE_VALF and HUGE_VALL, respectively.
If x or y is ±Inf, +Inf is returned (even if one of x or y is NaN).
If x or y is NaN, and the other is not ±Inf, a NaN is returned.
If both arguments are subnormal and the correct result is subnormal, a range error may occur and the correct result is returned.
When using the libm.a (-lm) library, if the correct value overflows, the hypot subroutine returns a HUGE_VAL value.
When using libmsaa.a (-lmsaa), if the correct value overflows, the hypot subroutine returns HUGE_VAL and sets the global variable errno to ERANGE.
These error-handling procedures may be changed with the matherr subroutine when using the libmsaa.a (-lmsaa) library.
feclearexcept Subroutine, fetestexcept Subroutine, and class, _class, finite, isnan, or unordered Subroutines.
The matherr (matherr Subroutine) subroutine, sqrt subroutine.
Subroutines Overview in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs.
math.h in AIX 5L Version 5.2 Files Reference.