conjf, conj, conjl

Header: <complex.h>

1-3) Computes the complex conjugate of z by reversing the sign of the imaginary part.

# Declarations

float complex conjf( float complex z );

(since C99)

double complex conj( double complex z );

(since C99)

long double complex conjl( long double complex z );

(since C99)

#define conj( z )

(since C99)

# Parameters

# Return value

The complex conjugate of z.

# Notes

On C99 implementations that do not implement I as _Imaginary_I, conj may be used to obtain complex numbers with negative zero imaginary part. In C11, the macro CMPLX is used for that purpose.

# Example

#include <stdio.h>
#include <complex.h>
 
int main(void)
{
    double complex z = 1.0 + 2.0*I;
    double complex z2 = conj(z);
    printf("The conjugate of %.1f%+.1fi is %.1f%+.1fi\n",
            creal(z), cimag(z), creal(z2), cimag(z2));
 
    printf("Their product is %.1f%+.1fi\n", creal(z*z2), cimag(z*z2));
}

# See also