[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

hypot Subroutine

Purpose

Computes the Euclidean distance function and complex absolute value.

Libraries

IEEE Math Library (libm.a)
System V Math Library (libmsaa.a)

Syntax

#include <math.h>
double hypot (x, y)
double x, y;

Description

Computes the square root of (x**2 + y**2) so that underflow does not occur and overflow occurs only if the final result warrants it.

Note: Compile any routine that uses subroutines from the libm.a library with the -lm flag. To compile the hypot.c file, for example:
cc hypot.c -lm

Parameters

x Specifies some double-precision floating-point value.
y Specifies some double-precision floating-point value.
z Specifies a structure that has two double elements (z = xi + yj).

Error Codes

When using the libm.a (-lm) library, if the correct value overflows, the hypot subroutine returns a HUGE_VAL value.

Note: (hypot (INF, value) and hypot (value, INF) are both equal to +INF for all values, even if value = NaN.

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.

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Related Information

The matherr subroutine, sqrt subroutine.

Subroutines Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]