Namensräume
Varianten
Aktionen

conjf, conj, conjl

Von cppreference.com
< c‎ | numeric‎ | complex
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 in Header <tgmath.h>
#define conj( z )
(4) (seit C99)
1-3) Berechnet die komplexe Konjugation von z, indem das Vorzeichen des imaginären Teils umgekehrt wird.
4) Typ-generische 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 ganzzahligen Typ hat, wird conj aufgerufen.

Inhalt

[edit] Parameter

z - complex argument

[edit] Rückgabewert

Die komplexe Konjugation von z.

[edit] Hinweise

Bei C99-Implementierungen, die I nicht als _Imaginary_I implementieren, kann conj verwendet werden, um komplexe Zahlen mit einem negativen Null-Imaginärteil zu erhalten. In C11 wird für diesen Zweck das Makro CMPLX verwendet.

[edit] 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

[edit] Referenzen

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

[edit] Siehe auch