Namespaces
Variants

conjf, conj, conjl

From cppreference.net
Definiert im Header <complex.h>
float complex conjf ( float complex z ) ;
(1) (seit C99)
double complex conj ( double complex z ) ;
(2) (seit C99)
long double complex conjl ( long double complex z ) ;
(3) (seit C99)
Definiert im Header <tgmath.h>
#define conj( z )
(4) (seit C99)
1-3) Berechnet die komplex Konjugierte von z durch Umkehrung des Vorzeichens des Imaginärteils.
4) Typgenerisches Makro: Wenn z den Typ long double complex , long double imaginary oder long double hat, wird conjl aufgerufen. Wenn z den Typ float complex , float imaginary oder float hat, wird conjf aufgerufen. Wenn z den Typ double complex , double imaginary , double oder einen beliebigen Ganzzahltyp hat, wird conj aufgerufen.

Inhaltsverzeichnis

Parameter

z - komplexes Argument

Rückgabewert

Das komplex Konjugierte von z .

Hinweise

Auf C99-Implementierungen, die I nicht als _Imaginary_I implementieren, kann conj verwendet werden, um komplexe Zahlen mit negativem Null-Imaginärteil zu erhalten. In C11 wird dafür das Makro CMPLX verwendet.

Beispiel

#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));
}

Ausgabe:

The conjugate of 1.0+2.0i is 1.0-2.0i
Their product is 5.0+0.0i

Referenzen

  • C11-Standard (ISO/IEC 9899:2011):
  • 7.3.9.4 Die conj-Funktionen (S. 198)
  • 7.25 Typgenerische Mathematik <tgmath.h> (S. 373-375)
  • G.7 Typgenerische Mathematik <tgmath.h> (S. 545)
  • C99-Standard (ISO/IEC 9899:1999):
  • 7.3.9.3 Die conj-Funktionen (S. 179)
  • 7.22 Typgenerische Mathematik <tgmath.h> (S. 335-337)
  • G.7 Typgenerische Mathematik <tgmath.h> (S. 480)

Siehe auch