creal


creal

Obtains the real part of a complex number

 #include <complex.h> double creal ( double complex z  ); float crealf ( float complex z  ); long double creall ( long double complex z  ); 

A complex number is represented as two floating-point numbers, one quantifying the real part and one quantifying the imaginary part. The creal( ) function returns the floating-point number that represents the real part of the complex argument.

Example

 double complex z = 4.5 - 6.7 * I; printf( "The complex variable z is equal to %.2f %+.2f \xD7 I.\n",         creal(z), cimag(z) ); 

This code produces the following output:

 The complex variable z is equal to 4.50 -6.70 x I. 

See Also

cimag( ), cabs( ), carg( ), conj( ), cproj( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net