# C complex.h conj,conjf and conjl

The C++ <complex.h> conj , conjf and conjl functions compute the conjugate of the complex number.The declaration of the function is shown below.

1 double complex conj(double complex z);
2 float complex conjf(float complex z);
3 long double complex conjl(long double complex z);

All the three functions compute the conjugate of the complex number,the only difference between them is their return type:

i)The ‘conj’ return the complex conjugate as double type
ii)The ‘conjf’ return the complex conjugate as float type and
iii)The ‘conjl’ return the complex conjugate as long double type.

Some points to note:

i)The complex number returned has the magnitude same as the complex number passed as the argument ,only the sign of the imaginary part is reversed but the sign of the real part remains unchanged.

#### double complex conj(double complex z);

Parameters:
z -The complex number whose conjugate is to be computed.

Return type
double -The complex conjugate of double type.

Code example

double complex c1=22.343 +I*37485.75 , c2 ;

c2=conj(c1);

printf( “Real part of c2=%lf \nImaginary part of c2=%lf” , creal(c2) , cimag(c2) );

Output,

Real part of c2=22.343000
Imaginary part of c2=-37485.750000

The magnitude of c2 is same as c1 only the sign of the imaginary part of the c2 is reversed.

#### float complex conjf(float complex z);

The conjf return complex conjugate of float type.

Parameters:
z -The complex number whose conjugate is to be computed.

Return type
double -The complex conjugate as float type.

Code example

double complex c1=1.387 +I*34.00 ;

float complex c2=conjf(c1); ; //May loss precision

printf( “Real part of c2=%lf \nImaginary part of c2=%lf” , creal(c2) , cimag(c2) );

Output,

Real part of c2=1.387
Imaginary part of c2=-34.000000

#### long double complex conjl(long double complex z);

The conjl return complex conjugate of long double type.

Parameters:
z -The complex number whose conjugate is to be computed.

Return type
double -The complex conjugate of long double type.

Code example

long double complex c1=12.007 +I*124.0009 ,
c2=conjl(c1 ); ;

printf( “Real part of c2=%lf \nImaginary part of c2=%lf” , creal(c2) , cimag(c2) );

Output,

Real part of c2=12.007
Imaginary part of c2=-124.0009