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 > C


HP Integrity Server Only
HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


cabs(), cabsf(), cabsl(), cabsw(), cabsq() — complex absolute value (also called norm, modulus, or magnitude) functions


#include <complex.h>

double cabs(double complex z);

float cabsf(float complex z);

long double cabsl(long double complex z);

extended cabsw(extended complex z);

quad cabsq(quad complex z);


These functions are available only for Integrity servers.

cabs() returns the complex absolute value of z.

cabsf() is a float complex version of cabs(); it takes a float complex argument and returns a float result.

cabsl() is a long double complex version of cabs(); it takes a long double complex argument and returns a long double result.

cabsw() is an extended complex version of cabs(); it takes an extended complex argument and returns an extended result.

cabsq() is equivalent to cabsl() on HP-UX systems.


To use these functions, compile with the default -Ae option. To use cabsw() or cabsq(), compile with the -fpwidetypes option. Make sure your program includes <complex.h>. Link in the math library by specifying -lm on the compiler or linker command line.


cabs(z) returns the same values and raises the same floating-point exceptions as hypot(creal(z),cimag(z)).

If the +Ocxlimitedrange compiler option is in effect, then cabs() may be computed with a faster method that does not match the regular specification for infinite and for extreme-magnitude extended and quad values. The HP C/C++ default is +Onocxlimitedrange. The +Ofltacc=relaxed option implies +Ocxlimitedrange.


No errors are defined.


cabs(), cabsf(), cabsl() : ISO/IEC C99 (including Annex G, "IEC 60559-compatible complex arithmetic")

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