Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > H

hypot(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

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 inexact 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.

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'')

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.