Namensräume
Varianten
Aktionen

cimagf, cimag, cimagl

Von cppreference.com
< c‎ | numeric‎ | complex
Definiert im Header <complex.h>
float       cimagf( float complex z );
(1) (seit C99)
double      cimag( double complex z );
(2) (seit C99)
long double cimagl( long double complex z );
(3) (seit C99)
Definiert in Header <tgmath.h>
#define cimag( z )
(4) (seit C99)
1-3) Gibt den Imaginärteil von z zurück.
4) Typ-generisches Makro: Wenn z vom Typ long double complex, long double imaginary oder long double ist, wird cimagl aufgerufen. Wenn z vom Typ float complex, float imaginary oder float ist, wird cimagf aufgerufen. Wenn z vom Typ double complex, double imaginary, double oder einem beliebigen Ganzzahltyp ist, wird cimag aufgerufen.

Inhalt

[edit] Parameter

z - complex argument

[edit] Rückgabewert

Der Imaginärteil von z.

Diese Funktion ist für alle möglichen Eingaben vollständig spezifiziert und unterliegt keinen Fehlern, die in math_errhandling beschrieben sind.

[edit] Hinweise

Für jede komplexe Variable z gilt: z == creal(z) + I*cimag(z).

[edit] Beispiel

#include <stdio.h>
#include <complex.h>
 
int main(void)
{    
    double complex z = 1.0 + 2.0*I;
    printf("%f%+fi\n", creal(z), cimag(z));
}

Ausgabe

1.000000+2.000000i

[edit] Referenzen

  • C11-Standard (ISO/IEC 9899:2011)
  • 7.3.9.2 The cimag functions (S: 197)
  • 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.2 The cimag functions (S: 178-179)
  • 7.22 Typ-generische Mathematik <tgmath.h> (S. 335-337)
  • G.7 Type-generic math <tgmath.h> (S: 480)

[edit] Siehe auch

(C99)(C99)(C99)
berechnet den Realteil einer komplexen Zahl
(Funktion) [bearbeiten]