abs
absolute value of a complex number
You're viewing an older version of this page (#3345). View the current version.
NAME
cabs, cabsf, cabsl
INTERFACE
#include <complex.h>
double cabs(double complex z ); float cabsf(float complex z ); long double cabsl(long double complex z );
DESCRIPTION
The cabs () function returns the absolute value of the complex number z = a+i*b. The result is a real number, i.e.
(1)
The function is actually an alias for hypot(a,b) = sqrt(a*a+b*b).
Link with -lm
CONFORMING TO
C99
SEE ALSO
abs (3), cimag (3), hypot (3), complex (7)
Compatibility
<table class="compat"> <tr><th></th><th>DOS</th><th>UNIX</th><th>Windows</th><th>ANSI C</th><th>C++ only</th></tr> <tr><td>cabs</td><td></td><td>•</td><td>•</td><td></td><td>•</td></tr> </table>