cargf, carg, cargl
提供: cppreference.com
ヘッダ <complex.h> で定義
|
||
float cargf( float complex z ); |
(1) | (C99以上) |
double carg( double complex z ); |
(2) | (C99以上) |
long double cargl( long double complex z ); |
(3) | (C99以上) |
ヘッダ <tgmath.h> で定義
|
||
#define carg( z ) |
(4) | (C99以上) |
1-3) 負の実軸に沿って分岐切断する、
z
の偏角を計算します。4) 型総称マクロ。
z
が long double complex、 long double imaginary または long 型の場合は cargl
が呼ばれます。 z
が float complex、 float または float 型の場合は cargf
が呼ばれます。 z
が double complex、 double imaginary、 double または任意の整数型の場合は carg
が呼ばれます。目次 |
[編集] 引数
z | - | 複素数の引数 |
[編集] 戻り値
エラーが発生しなければ、区間 [−π; π] 内の z
の偏角を返します。
エラーおよび特殊なケースは、この関数が atan2(cimag(z), creal(z)) として実装されているかのように処理されます。
[編集] 例
Run this code
#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)); }
出力:
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
[編集] 参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.3.9.1 The carg functions (p: 196)
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
- G.7 Type-generic math <tgmath.h> (p: 545)
- C99 standard (ISO/IEC 9899:1999):
- 7.3.9.1 The carg functions (p: 178)
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
- G.7 Type-generic math <tgmath.h> (p: 480)
[編集] 関連項目
(C99)(C99)(C99) |
複素数の絶対値を計算します (関数) |
(C99)(C99) |
象限を判断するために符号を使用して逆正接を計算します (関数) |
arg の C++リファレン��
|