clogf, clog, clogl
|
Definiert im Header
<complex.h>
|
||
| (1) | (seit C99) | |
| (2) | (seit C99) | |
| (3) | (seit C99) | |
|
Definiert im Header
<tgmath.h>
|
||
|
#define log( z )
|
(4) | (seit C99) |
z
mit Verzweigungsschnitt entlang der negativen reellen Achse.
z
den Typ
long
double
complex
hat, wird
clogl
aufgerufen. Wenn
z
den Typ
double
complex
hat, wird
clog
aufgerufen. Wenn
z
den Typ
float
complex
hat, wird
clogf
aufgerufen. Wenn
z
reell oder ganzzahlig ist, ruft das Makro die entsprechende reelle Funktion auf (
logf
,
log
,
logl
). Wenn
z
imaginär ist, wird die entsprechende komplexe Zahlenversion aufgerufen.
Inhaltsverzeichnis |
Parameter
| z | - | komplexes Argument |
Rückgabewert
Wenn keine Fehler auftreten, wird der komplexe natürliche Logarithmus von
z
zurückgegeben, im Bereich eines Streifens im Intervall
[−iπ, +iπ]
entlang der imaginären Achse und mathematisch unbeschränkt entlang der reellen Achse.
Fehlerbehandlung und spezielle Werte
Fehler werden gemeldet konsistent mit math_errhandling
Wenn die Implementierung IEEE-Gleitkommaarithmetik unterstützt,
- Die Funktion ist auf dem Verzweigungsschnitt stetig unter Berücksichtigung des Vorzeichens des Imaginärteils
- clog ( conj ( z ) ) == conj ( clog ( z ) )
-
Wenn
zgleich-0+0iist, ist das Ergebnis-∞+πiund FE_DIVBYZERO wird ausgelöst -
Wenn
zgleich+0+0iist, ist das Ergebnis-∞+0iund FE_DIVBYZERO wird ausgelöst -
Wenn
zgleichx+∞iist (für jedes endliche x), ist das Ergebnis+∞+πi/2 -
Wenn
zgleichx+NaNiist (für jedes endliche x), ist das ErgebnisNaN+NaNiund FE_INVALID kann ausgelöst werden -
Wenn
zgleich-∞+yiist (für jedes endliche positive y), ist das Ergebnis+∞+πi -
Wenn
zgleich+∞+yiist (für jedes endliche positive y), ist das Ergebnis+∞+0i -
Wenn
zgleich-∞+∞iist, ist das Ergebnis+∞+3πi/4 -
Wenn
zgleich+∞+∞iist, ist das Ergebnis+∞+πi/4 -
Wenn
zgleich±∞+NaNiist, ist das Ergebnis+∞+NaNi -
Wenn
zgleichNaN+yiist (für jedes endliche y), ist das ErgebnisNaN+NaNiund FE_INVALID kann ausgelöst werden -
Wenn
zgleichNaN+∞iist, ist das Ergebnis+∞+NaNi -
Wenn
zgleichNaN+NaNiist, ist das ErgebnisNaN+NaNi
Hinweise
Der natürliche Logarithmus einer komplexen Zahl z mit Polarkoordinatenkomponenten (r,θ) entspricht ln r + i(θ+2nπ) , mit dem Hauptwert ln r + iθ
Beispiel
#include <stdio.h> #include <math.h> #include <complex.h> int main(void) { double complex z = clog(I); // r = 1, θ = pi/2 printf("2*log(i) = %.1f%+fi\n", creal(2*z), cimag(2*z)); double complex z2 = clog(sqrt(2)/2 + sqrt(2)/2*I); // r = 1, θ = pi/4 printf("4*log(sqrt(2)/2+sqrt(2)i/2) = %.1f%+fi\n", creal(4*z2), cimag(4*z2)); double complex z3 = clog(-1); // r = 1, θ = pi printf("log(-1+0i) = %.1f%+fi\n", creal(z3), cimag(z3)); double complex z4 = clog(conj(-1)); // or clog(CMPLX(-1, -0.0)) in C11 printf("log(-1-0i) (the other side of the cut) = %.1f%+fi\n", creal(z4), cimag(z4)); }
Ausgabe:
2*log(i) = 0.0+3.141593i 4*log(sqrt(2)/2+sqrt(2)i/2) = 0.0+3.141593i log(-1+0i) = 0.0+3.141593i log(-1-0i) (the other side of the cut) = 0.0-3.141593i
Referenzen
- C11-Standard (ISO/IEC 9899:2011):
-
- 7.3.7.2 The clog functions (S. 195)
-
- 7.25 Type-generic math <tgmath.h> (S. 373-375)
-
- G.6.3.2 The clog functions (S. 543-544)
-
- G.7 Type-generic math <tgmath.h> (S. 545)
- C99-Standard (ISO/IEC 9899:1999):
-
- 7.3.7.2 The clog functions (S. 176-177)
-
- 7.22 Type-generic math <tgmath.h> (S. 335-337)
-
- G.6.3.2 The clog functions (S. 478-479)
-
- G.7 Type-generic math <tgmath.h> (S. 480)
Siehe auch
|
(C99)
(C99)
(C99)
|
berechnet die komplexe Basis-e-Exponentialfunktion
(Funktion) |
|
(C99)
(C99)
|
berechnet den natürlichen Logarithmus (Basis-
e
) (
ln(x)
)
(Funktion) |
|
C++-Dokumentation
für
log
|
|