conjf, conj, conjl
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <complex.h> で定義
|
||
float complex conjf( float complex z ); |
(1) | (C99以上) |
double complex conj( double complex z ); |
(2) | (C99以上) |
long double complex conjl( long double complex z ); |
(3) | (C99以上) |
| ヘッダ <tgmath.h> で定義
|
||
#define conj( z ) |
(4) | (C99以上) |
4) 型総称マクロ。
z が long double complex、 long double imaginary または long double の場合は conjl が呼ばれます。 z が float complex、 float imaginary または float の場合は conjf が呼ばれます。 z が double complex、 double imaginary、 double または任意の整数型の場合は conj が呼ばれます。引数
| z | - | 複素数の引数 |
戻り値
z の複素共役。
ノート
I を _Imaginary_I として実装しない C99 処理系では、負のゼロを虚部に持つ複素数を取得するために conj が使用されることがあります。 C11 ではマクロ CMPLX がこの目的に使用されます。
例
Run this code
#include <stdio.h>
#include <complex.h>
int main(void)
{
double complex z = 1.0 + 2.0*I;
double complex z2 = conj(z);
printf("The conjugate of %.1f%+.1fi is %.1f%+.1fi\n",
creal(z), cimag(z), creal(z2), cimag(z2));
printf("Their product is %.1f%+.1fi\n", creal(z*z2), cimag(z*z2));
}
出力:
The conjugate of 1.0+2.0i is 1.0-2.0i
Their product is 5.0+0.0i
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.3.9.4 The conj functions (p: 198)
- 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.3 The conj functions (p: 179)
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
- G.7 Type-generic math <tgmath.h> (p: 480)
関連項目
conj の C++リファレンス
|