hypot(), hypotf(), cabs(), cabsf()

euclidean distance and complex absolute value functions 

Function


SYNOPSIS

#include <math.h>

double hypot(double x, double y)

float hypotf(float x, float y)

double cabs(struct complex { double x;; double y; } z)

float cabsf(struct complex { float x;; float y; } z)


DESCRIPTION

The hypot() and cabs() functions computes the sqrt(x*x+y*y) in such a way that underflow does not happen, and overflow occurs only if the final result deserves it.

hypot(Infinity, v) = hypot(v, Infinity) = +Infinity for all v, including NaN.

The cabs() function is equivalent to:

hypot(z.x, z.y)

The hypotf() function is a single-precision version of hypot(). The cabsf() function is a single-precision version of cabs().


PARAMETERS

x 

Is the length of one of the sides of the triangle.

y 

Is the length of another of the sides of the triangle.

z 

Is a complex number.


RETURN VALUES

hypot() returns the hypotenuse of a triangle with sides x and y. cabs() returns the hypotenuse of a triangle with sides z.x and z.y.

If the correct value would cause overflow, then:

If the result underflows, 0 is returned.

If x or y is NaN, NaN is returned.


CONFORMANCE

hypot(): UNIX 98

cabs(): 4.4 BSD

hypotf(), cabs(): PTC MKS Toolkit UNIX APIs extension


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
math(), sqrt()


PTC MKS Toolkit 10.4 Documentation Build 39.