cabsf, cabs, cabsl

From cppreference.com
< c‎ | numeric‎ | complex
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.

Contents

[edit] Parameters

z - complex argument

[edit] Return value

The complex absolute value of z.

[edit] Example

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

Output:

2.236068

[edit] See also

(C99)(C99)(C99)
computes the phase angle of a complex number
(function)
computes absolute value of an integral value (|x|)
(function)
(C99)(C99)
computes absolute value of a floating-point value (|x|)
(function)
(C99)(C99)(C99)
computes square root of the sum of the squares of two given numbers (x2
+y2
)
(function)