名前空間
変種
操作

conjf, conj, conjl

From cppreference.com
< c‎ | numeric‎ | complex
ヘッダー <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以降)
1-3) z複素共役を、虚数部分の符号を反転させることによって計算します。
4) 型汎用マクロ: zlong double complexlong double imaginary、または long double 型の場合、conjl が呼び出されます。 zfloat complexfloat imaginary、または float 型の場合、conjf が呼び出されます。 zdouble complexdouble imaginarydouble、または任意の整数型の場合、conj が呼び出されます。

目次

[編集] パラメータ

z - 複素数引数

[編集] 戻り値

z の複素共役。

[編集] 注記

I_Imaginary_I として実装していない C99 実装では、conj を使用して負のゼロ虚部を持つ複素数を取得できます。C11 では、マクロ CMPLX がこの目的で使用されます。

[編集]

#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標準 (ISO/IEC 9899:2011)
  • 7.3.9.4 The conj functions (p: 198)
  • 7.25 型総称数学関数 <tgmath.h> (p: 373-375)
  • G.7 Type-generic math <tgmath.h> (p: 545)
  • C99標準 (ISO/IEC 9899:1999)
  • 7.3.9.3 The conj functions (p: 179)
  • 7.22 型総称数学関数 <tgmath.h> (p: 335-337)
  • G.7 Type-generic math <tgmath.h> (p: 480)

[編集] 関連項目

English 日本語 中文(简体) 中文(繁體)