名前空間
変種
操作

cimagf, cimag, cimagl

From cppreference.com
< c‎ | numeric‎ | complex
ヘッダー <complex.h> で定義
float       cimagf( float complex z );
(1) (C99以降)
double      cimag( double complex z );
(2) (C99以降)
long double cimagl( long double complex z );
(3) (C99以降)
ヘッダー <tgmath.h> で定義
#define cimag( z )
(4) (C99以降)
1-3)z の虚部を返します。
4) 型汎用マクロ: z の型が long double complex, long double imaginary, または long double の場合、cimagl が呼び出されます。z の型が float complex, float imaginary, または float の場合、cimagf が呼び出されます。z の型が double complex, double imaginary, double, または任意の整数型の場合、cimag が呼び出されます。

目次

[編集] パラメータ

z - 複素数引数

[編集] 戻り値

z の虚部。

この関数は、すべての可能な入力に対して完全に指定されており、math_errhandling に記載されているエラーの対象にはなりません。

[編集] 注記

任意の複素数変数 z について、z == creal(z) + I*cimag(z) が成り立ちます。

[編集]

#include <stdio.h>
#include <complex.h>
 
int main(void)
{    
    double complex z = 1.0 + 2.0*I;
    printf("%f%+fi\n", creal(z), cimag(z));
}

出力

1.000000+2.000000i

[編集] 参考文献

  • C11標準 (ISO/IEC 9899:2011)
  • 7.3.9.2 The cimag functions (p: 197)
  • 7.25 型総称数学関数 <tgmath.h> (p: 373-375)
  • G.7 Type-generic math <tgmath.h> (p: 545)
  • C99標準 (ISO/IEC 9899:1999)
  • 7.3.9.2 The cimag functions (p: 178-179)
  • 7.22 型総称数学関数 <tgmath.h> (p: 335-337)
  • G.7 Type-generic math <tgmath.h> (p: 480)

[編集] 関連項目

(C99)(C99)(C99)
複素数の実部を計算する
(関数) [編集]
English 日本語 中文(简体) 中文(繁體)