cpowf, cpow, cpowl
提供: cppreference.com
ヘッダ <complex.h> で定義
|
||
(1) | (C99以上) | |
(2) | (C99以上) | |
(3) | (C99以上) | |
ヘッダ <tgmath.h> で定義
|
||
#define pow( x, y ) |
(4) | (C99以上) |
1-3) 第1引数について負の実軸に沿った分岐切断を持つ、複素冪関数 xy
を計算します。
を計算します。
4) 型総称マクロ。 いずれかの引数が long double complex 型の場合は
cpowl
が呼ばれ、いずれかの引数が double complex 型の場合は cpow
が呼ばれ、いずれかの引数が float complex の場合は cpowf
が呼ばれます。 引数が実数または整数の場合、このマクロは対応する実数の関数 (powf、 pow、 powl) を呼びます。 いずれかの引数が虚数の場合は、対応する複素数版が呼ばれます。目次 |
[編集] 引数
x, y | - | 複素数の引数 |
[編集] 戻り値
エラーが発生しなければ、複素冪 xy
が返されます。
エラーおよび特殊なケースは、この演算が cexp(y*clog(x)) として実装されているかのように処理されます。 ただし、処理系は特殊なケースをもっと注意深く扱っても構いません。
[編集] 例
Run this code
#include <stdio.h> #include <complex.h> int main(void) { double complex z = cpow(1.0+2.0*I, 2); printf("(1+2i)^2 = %.1f%+.1fi\n", creal(z), cimag(z)); double complex z2 = cpow(-1, 0.5); printf("(-1+0i)^0.5 = %.1f%+.1fi\n", creal(z2), cimag(z2)); double complex z3 = cpow(conj(-1), 0.5); // other side of the cut printf("(-1-0i)^0.5 = %.1f%+.1fi\n", creal(z3), cimag(z3)); double complex z4 = cpow(I, I); // i^i = exp(-pi/2) printf("i^i = %f%+fi\n", creal(z4), cimag(z4)); }
出力:
(1+2i)^2 = -3.0+4.0i (-1+0i)^0.5 = 0.0+1.0i (-1-0i)^0.5 = 0.0-1.0i i^i = 0.207880+0.000000i
[編集] 参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.3.8.2 The cpow functions (p: 195-196)
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
- G.6.4.1 The cpow functions (p: 544)
- G.7 Type-generic math <tgmath.h> (p: 545)
- C99 standard (ISO/IEC 9899:1999):
- 7.3.8.2 The cpow functions (p: 177)
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
- G.6.4.1 The cpow functions (p: 479)
- G.7 Type-generic math <tgmath.h> (p: 480)
[編集] 関連項目
(C99)(C99)(C99) |
複素数の平方根を計算します (関数) |
(C99)(C99) |
x の y 乗 (xy) を計算します (関数) |
pow の C++リファレンス
|