CABS 3CW "21 March 2008" "mathcw-1.00"

Table of contents


NAME

cabsf, cabs, cabsl, cabsw, cabsq, cabsll, cabsdf, cabsd, cabsdl, cabsdll - complex absolute value function

SYNOPSIS

cc [ flags ] -I/usr/local/include file(s) -L/usr/local/lib -lmcw [ ... ]

#include <mathcw.h>

#include <complexcw.h>

extern float cabsf (float complex z);

extern double cabs (double complex z);

extern long double cabsl (long double complex z);

extern __float80 cabsw (__float80 complex z);

extern __float128 cabsq (__float128 complex z);

extern long_long_double cabsll (long_long_double complex z);

extern decimal_float cabsdf (decimal_float complex z);

extern decimal_double cabsd (decimal_double complex z);

extern decimal_long_double cabsdl (decimal_long_double complex z);

extern decimal_long_long_double cabsdll (decimal_long_long_double complex z);

NB: Functions with prototypes containing underscores in type names may be available only with certain extended compilers.


DESCRIPTION

Compute the absolute value of the complex value z.

When compiler support for complex types is lacking, consider using the cx family of functions instead.


CAVEAT

The real absolute-value function cannot overflow or underflow, since its operation involves at most a sign change. By contrast, the complex absolute-value function is subject to overflow for arguments within a factor of 1/sqrt(2) ~= 0.707 of the largest finite floating-point number. In practice, this may require designing computer algorithms for complex arithmetic to provide suitable exact scaling of intermediate expressions in order to avoid such overflow.

RETURN VALUES

Return the absolute value.

ERRORS

If either component of the argument is a NaN, return the argument without setting errno.

SEE ALSO

cadd(3CW), carg(3CW), ccopy(3CW), cdiv(3CW), cimag(3CW), cmul(3CW), cneg(3CW), conj(3CW), cproj(3CW), creal(3CW), cset(3CW), csub(3CW).