HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)
h
hypot(3M) hypot(3M)
NAME
hypotf( ), hypotl(), hypotw(), hypotq() - Euclidean distance functions
SYNOPSIS
#include <math.h>
double hypot(double x, double y);
HP Integrity Server Only
float hypotf(float x, float y);
long double hypotl(long double x, long double y);
extended hypotw(extended x, extended y);
quad hypotq(quad x, quad y);
DESCRIPTION
hypot() computes the square root of the sum of the squares of x and y, without undue overflow or
underflow.
Integrity Server Only
hypotf() is a float version of hypot(); it takes float arguments and returns a float
result.
hypotl() is a long double version of hypot(); it takes long double arguments and returns a
long double result.
hypotw() is an extended version of hypot(); it takes extended arguments and returns an
extended result.
hypotq() is equivalent to hypotl() on HP-UX systems.
USAGE
To use any of these functions, compile either with the default -Ae option or with the
-Aa and
-D_HPUX_SOURCE options.
To use (for Integrity servers)
hypotw() or hypotq(), compile also with the -fpwidetypes option.
Make sure your program includes
<math.h>. Link in the math library by specifying -lm
on the compiler
or linker command line.
RETURN VALUE
hypot(x,y), hypot(y,x), and hypot(x,-y
) are equivalent.
hypot(x,±0) is equivalent to fabs(x).
hypot(±Inf,y) returns +Inf, even if y is a NaN.
If both arguments are NaNs, then hypot() returns a NaN.
hypot() returns infinity in lieu of a value whose magnitude is too large, and raises the overflow and inex-
act exceptions.
hypot() raises the underflow and inexact exceptions whenever a result is tiny (essentially denormal or
zero) and thereby suffers loss of accuracy, and may raise those exceptions if the result is merely tiny.
hypot() raises the inexact exception whenever a rounded result does not equal the mathematical result.
ERRORS
No errors are defined.
SEE ALSO
cabs(3M), fabs(3M), sqrt(3M), math(5).
STANDARDS CONFORMANCE
hypot() : SVID3, XPG4.2, ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
hypotf(), hypotl() : ISO/IEC C99 (including Annex F, ‘‘IEC 60559 floating-point arithmetic’’)
HP-UX 11i Version 3: February 2007 − 1 − Hewlett-Packard Company 659