cargf, carg, cargl
From cppreference.net
|
Definiert im Header
<complex.h>
|
||
|
float
cargf
(
float
complex
z
)
;
|
(1) | (seit C99) |
|
double
carg
(
double
complex
z
)
;
|
(2) | (seit C99) |
|
long
double
cargl
(
long
double
complex
z
)
;
|
(3) | (seit C99) |
|
Definiert im Header
<tgmath.h>
|
||
|
#define carg( z )
|
(4) | (seit C99) |
1-3)
Berechnet das Argument (auch Phasenwinkel genannt) von
z
, mit einem Verzweigungsschnitt entlang der negativen reellen Achse.
4)
Typgenerisches Makro: Wenn
z
den Typ
long
double
complex
,
long
double
imaginary
oder
long
double
hat, wird
cargl
aufgerufen. Wenn
z
den Typ
float
complex
,
float
imaginary
oder
float
hat, wird
cargf
aufgerufen. Wenn
z
den Typ
double
complex
,
double
imaginary
,
double
oder einen beliebigen Ganzzahltyp hat, wird
carg
aufgerufen.
Inhaltsverzeichnis |
Parameter
| z | - | komplexes Argument |
Rückgabewert
Wenn keine Fehler auftreten, gibt den Phasenwinkel von
z
im Intervall
[−π; π]
zurück.
Fehler und Sonderfälle werden behandelt, als ob die Funktion implementiert wäre als atan2 ( cimag ( z ) , creal ( z ) )
Beispiel
Diesen Code ausführen
#include <stdio.h> #include <complex.h> int main(void) { double complex z1 = 1.0+0.0*I; printf("phase angle of %.1f%+.1fi is %f\n", creal(z1), cimag(z1), carg(z1)); double complex z2 = 0.0+1.0*I; printf("phase angle of %.1f%+.1fi is %f\n", creal(z2), cimag(z2), carg(z2)); double complex z3 = -1.0+0.0*I; printf("phase angle of %.1f%+.1fi is %f\n", creal(z3), cimag(z3), carg(z3)); double complex z4 = conj(z3); // or CMPLX(-1, -0.0) printf("phase angle of %.1f%+.1fi (the other side of the cut) is %f\n", creal(z4), cimag(z4), carg(z4)); }
Ausgabe:
phase angle of 1.0+0.0i is 0.000000 phase angle of 0.0+1.0i is 1.570796 phase angle of -1.0+0.0i is 3.141593 phase angle of -1.0-0.0i (the other side of the cut) is -3.141593
Referenzen
- C11-Standard (ISO/IEC 9899:2011):
-
- 7.3.9.1 The carg functions (S. 196)
-
- 7.25 Type-generic math <tgmath.h> (S. 373-375)
-
- G.7 Type-generic math <tgmath.h> (S. 545)
- C99-Standard (ISO/IEC 9899:1999):
-
- 7.3.9.1 The carg functions (S. 178)
-
- 7.22 Type-generic math <tgmath.h> (S. 335-337)
-
- G.7 Type-generic math <tgmath.h> (S. 480)
Siehe auch
|
(C99)
(C99)
(C99)
|
berechnet den Betrag einer komplexen Zahl
(Funktion) |
|
(C99)
(C99)
|
berechnet den Arkustangens unter Verwendung von Vorzeichen zur Bestimmung der Quadranten
(Funktion) |
|
C++-Dokumentation
für
arg
|
|