Namespaces
Variants
Views
Actions

cabsf, cabs, cabsl

From cppreference.com
< c‎ | numeric‎ | complex
Revision as of 20:06, 5 March 2014 by Newatthis (Talk | contribs)

Defined in header <complex.h>
float       cabsf( float complex z );
(since C99)
double      cabs( double complex z );
(since C99)
long double cabsl( long double complex z );
(since C99)

Computes the complex absolute value of z.

Parameters

z - complex argument

Return value

The complex absolute value of z.

Example

#include <stdio.h>
#include <complex.h>
 
int main()
{
 
    double x = cabs(1.0 + 2.0*I);
    printf("%f\n", x);
 
    return 0;
}

Output:

2.236068