Namespaces
Variants

cimagf, cimag, cimagl

From cppreference.net
헤더 파일에 정의됨 <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 cimag 함수들 (p: 197)
  • 7.25 Type-generic math <tgmath.h> (p: 373-375)
  • G.7 Type-generic math <tgmath.h> (p: 545)
  • C99 표준 (ISO/IEC 9899:1999):
  • 7.3.9.2 cimag 함수들 (p: 178-179)
  • 7.22 Type-generic math <tgmath.h> (p: 335-337)
  • G.7 Type-generic math <tgmath.h> (p: 480)

참조

(C99) (C99) (C99)
복소수의 실수부를 계산함
(함수)
C++ 문서 for imag