Namespaces
Variants

ccosf, ccos, ccosl

From cppreference.net
헤더 파일에 정의됨 <complex.h>
float complex ccosf ( float complex z ) ;
(1) (C99부터)
double complex ccos ( double complex z ) ;
(2) (C99부터)
long double complex ccosl ( long double complex z ) ;
(3) (C99부터)
헤더 파일에 정의됨 <tgmath.h>
#define cos( z )
(4) (C99부터)
1-3) z 의 복소 코사인을 계산합니다.
4) 타입-제네릭 매크로: z long double complex 타입을 가지면 ccosl 이 호출됩니다. z double complex 타입을 가지면 ccos 이 호출됩니다. z float complex 타입을 가지면 ccosf 이 호출됩니다. z 가 실수 또는 정수이면, 매크로는 해당 실수 함수( cosf , cos , cosl )를 호출합니다. z 가 순허수이면, 매크로는 함수 cosh 의 해당 실수 버전을 호출하여 cos(iy) = cosh(y) 공식을 구현하며, 반환 타입은 실수입니다.

목차

매개변수

z - 복소 인수

반환값

오류가 발생하지 않으면, z 의 복소 코사인이 반환됩니다.

오류 및 특수한 경우들은 이 연산이 ccosh ( I * z ) 로 구현된 것처럼 처리됩니다.

참고 사항

코사인은 복소 평면에서 정칙 함수이며, 가지 절단(branch cut)이 없습니다.

Mathematical definition of the cosine is cos z =
e iz
+e -iz
2

예제

#include <stdio.h>
#include <math.h>
#include <complex.h>
int main(void)
{
    double complex z = ccos(1);  // 실수 축에서 실제 코사인처럼 동작함
    printf("cos(1+0i) = %f%+fi ( cos(1)=%f)\n", creal(z), cimag(z), cos(1));
    double complex z2 = ccos(I); // 허수 축에서 실제 쌍곡선 코사인처럼 동작함
    printf("cos(0+1i) = %f%+fi (cosh(1)=%f)\n", creal(z2), cimag(z2), cosh(1));
}

출력:

cos(1+0i) = 0.540302-0.000000i ( cos(1)=0.540302)
cos(0+1i) = 1.543081-0.000000i (cosh(1)=1.543081)

참고문헌

  • C11 표준 (ISO/IEC 9899:2011):
  • 7.3.5.4 The ccos functions (p: 191)
  • 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.5.4 The ccos functions (p: 173)
  • 7.22 Type-generic math <tgmath.h> (p: 335-337)
  • G.7 Type-generic math <tgmath.h> (p: 480)

참고 항목

(C99) (C99) (C99)
복소 사인 계산
(함수)
(C99) (C99) (C99)
복소 탄젠트 계산
(함수)
(C99) (C99) (C99)
복소 아크 코사인 계산
(함수)
(C99) (C99)
코사인 계산 ( cos(x) )
(함수)
C++ 문서 for cos