C Programming/complex.h/cimag

From Wikibooks, open books for an open world
Jump to navigation Jump to search


double cimag(double complex z);
float cimagf(float complex z);
long double cimagl(long double complex z);


cimag is a complex function in c programming. As complex numbers contain two parts, one real part and one imaginary part, this function is used to declare the imaginary part of a complex number. For example, let 'M' be any complex number which can be represented using c functions as follows:

M = creal(M) + cimag(M) * i
where creal(M) = real part of M.
The function returns the imaginary part of the complex no.