complex
From cppreference.net
Complex number arithmetic
| Types and the imaginary constant | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Manipulation | |||||||||||||||||||||||||||||||
| Power and exponential functions | |||||||||||||||||||||||||||||||
| Trigonometric functions | |||||||||||||||||||||||||||||||
| Hyperbolic functions | |||||||||||||||||||||||||||||||
|
헤더 파일에 정의됨
<complex.h>
|
||
|
#define complex _Complex
|
(C99부터) | |
이 매크로는 복소수 타입 을 식별하는 데 사용되는 타입 지정자로 확장됩니다.
프로그램은
complex
매크로를 정의 해제하고 이후 재정의할 수 있습니다.
예제
이 코드 실행
#include <complex.h> #include <math.h> #include <stdio.h> void print_complex(const char* note, complex z) { printf("%s %f%+f*i\n", note, creal(z), cimag(z)); } int main(void) { double complex z = -1.0 + 2.0*I; print_complex("z =", z); print_complex("z\u00B2 =", z * z); double complex z2 = ccos(2.0 * carg(z)) + csin(2.0 * carg(z))*I; print_complex("z\u00B2 =", cabs(z) * cabs(z) * z2); }
출력:
z = -1.000000+2.000000*i z² = -3.000000-4.000000*i z² = -3.000000-4.000000*i
참고문헌
- C23 표준 (ISO/IEC 9899:2024):
-
- 7.3.1/4 complex (p: TBD)
- C17 표준 (ISO/IEC 9899:2018):
-
- 7.3.1/4 complex (p: 136)
- C11 표준 (ISO/IEC 9899:2011):
-
- 7.3.1/4 complex (p: 188)
- C99 표준 (ISO/IEC 9899:1999):
-
- 7.3.1/2 복소수 (p: 170)
참고 항목
|
(C99)
|
허수 타입 매크로
(키워드 매크로) |