conj(), conjf(), conjl() — Calculate the complex conjugate

Standards

Standards / Extensions C or C++ Dependencies

C99
Single UNIX Specification, Version 3

both

z/OS V1R7
a compiler that is designed
to support C99

Format

#include <complex.h>

double complex conj(double complex z);
float complex conjf(float complex z);
long double complex conjl(long double complex z);

General description

The conj() family of functions compute the complex conjugate of z by reversing the sign of its imaginary part.
Note: The following table shows the viable formats for these functions. See IEEE binary floating-point for more information about IEEE Binary Floating-Point.
Function Hex IEEE
conj X X
conjf X X
conjl X X

Returned value

If successful, they return the complex conjugate value.

Example

/*
 *  This example illustrates the complex conjugate function
 */
#include <complex.h>
#include <stdio.h>

void main()
{
   long double complex z = -2.99 - I*3.99, zres;
   zres = conjl(z);
   printf("The complex conjugate of %Lf + %Lf*I is %Lf + %Lf*I\n",creall(z), cimagl(z), zres);
}

Output
The complex conjugate of -2.990000 + -3.990000*I is -2.990000 + 3.990000*I

Related information