cimagf, cimag, cimagl

Header: <complex.h>

1-3) Returns the imaginary part of z.

# Declarations

float cimagf( float complex z );

(since C99)

double cimag( double complex z );

(since C99)

long double cimagl( long double complex z );

(since C99)

#define cimag( z )

(since C99)

# Parameters

# Return value

The imaginary part of z.

# Notes

For any complex variable z, z == creal(z) + I*cimag(z).

# Example

#include <stdio.h>
#include <complex.h>
 
int main(void)
{    
    double complex z = 1.0 + 2.0*I;
    printf("%f%+fi\n", creal(z), cimag(z));
}

# See also