# cabsf, cabs, cabsl

< c‎ | numeric‎ | complex

Complex number arithmetic
Types and the imaginary constant
 complex(C99) _Complex_I(C99) CMPLX(C11)
 imaginary(C99) _Imaginary_I(C99) I(C99)
Manipulation
 cimag(C99) creal(C99) carg(C99)
 cabs(C99) conj(C99) cproj(C99)
Power and exponential functions
 cexp(C99) clog(C99)
 cpow(C99) csqrt(C99)
Trigonometric functions
 ccos(C99) csin(C99) ctan(C99)
 cacos(C99) casin(C99) catan(C99)
Hyperbolic functions
 ccosh(C99) csinh(C99) ctanh(C99)
 cacosh(C99) casinh(C99) catanh(C99)

 Defined in header  float       cabsf( float complex z ); (1) (since C99) double      cabs( double complex z ); (2) (since C99) long double cabsl( long double complex z ); (3) (since C99) Defined in header  #define fabs( z ) (4) (since C99)
1-3) Computes the complex absolute value (also known as norm, modulus, or magnitude) of z.
4) Type-generic macro: if z has type long double complex or long double imaginary, cabsl is called. If z has type float complex or float imaginary, cabsf is called. If z has type double complex or double imaginary, cabs is called. For real and integer types, the corresponding version of fabs is called.

## Contents

### Parameters

 z - complex argument

### Return value

If no errors occur, returns the absolute value (norm, magnitude) of z.

Errors and special cases are handled as if the function is implemented as hypot(creal(z), cimag(z))

### Example

#include <stdio.h>
#include <complex.h>

int main(void)
{
double complex z = 1.0 + 1.0*I;
printf("%.1f%+.1fi cartesian is rho=%f theta=%f polar\n",
creal(z), cimag(z), cabs(z), carg(z));
}

Output:

1.0+1.0i cartesian is rho=1.414214 theta=0.785398 polar