imag
raw OCR
Returns the imaginary part of a complex number.
Defined in header <complex.h>
Syntax
#include <complex.h>
double imag(complex x);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ | ■ |
Remarks
The data associated to a complex number consists of two floating-point (double) numbers. Imag returns the one considered to be the imaginary part.
Return value
The imaginary part of the complex number.
See also
Example
#include <coinplex.h>
int main(void)
double X = 3.1, y = 4.2;
complex z = complex(x,y);
cout << "z = " « z « "\n";
cout << " has real part = " « real(z) « "\n";
cout « " and imaginary real part = " « imag(z) << "\n";
cout « "z has complex conjugate = " << conj(z) « "\n";
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/complex.h/imag/
· short form /3.1/imag/