[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, 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 (matherr Subroutine) subroutine, sqrt subroutine.

Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]