sin, sinf, sinl

부동 소수점 값의 사인을 계산합니다.

구문

double sin(double x);
float sinf(float x);
long double sinl(long double x);
#define sin(x) // Requires C11 or higher
float sin(float x);  // C++ only
long double sin(long double x);  // C++ only

매개 변수

x
각도(라디안)입니다.

반환 값

sin 함수는 x의 사인을 반환합니다. 263보다 크거나 같거나 -263보다 작거나 같은 경우 x 결과의 유의성이 손실됩니다.

입력 SEH 예외 _matherr 예외
± QNaN, IND 없음 _DOMAIN
± INF(sin, sinf, sinl) INVALID _DOMAIN

반환 코드에 대한 자세한 내용은 , , 및 를 참조하세요errno._sys_nerr_sys_errlist_doserrno

설명

C++에서는 오버로드를 허용하므로 sin 또는 float 값을 사용 및 반환하는 long double의 오버로드를 호출할 수 있습니다. C 프로그램에서 매크로를 사용하여 이 함수를 <tgmath.h> 호출하지 않는 한 항상 이 함수 sin 를 사용하고 반환합니다 double.

매크로를 <tgmath.h> sin() 사용하는 경우 인수 형식에 따라 선택한 함수 버전이 결정됩니다. 자세한 내용은 형식 제네릭 수학을 참조하세요.

기본적으로 이 함수의 전역 상태는 애플리케이션으로 범위가 지정됩니다. 이 동작을 변경하려면 CRT의 전역 상태를 참조하세요.

요구 사항

루틴에서 반환된 값 필수 헤더(C) 필수 헤더(C++)
sin, sinf, sinl <math.h> <cmath> 또는 <math.h>
sin 매크로 <tgmath.h>

호환성에 대한 자세한 내용은 호환성을 참조하세요.

예시

// crt_sincos.c
// This program displays the sine and cosine of pi / 2.
// Compile by using: cl /W4 crt_sincos.c

#include <math.h>
#include <stdio.h>

int main( void)
{
   double pi = 3.1415926535;
   double x, y;

   x = pi / 2;
   y = sin( x );
   printf( "sin( %f ) = %f\n", x, y );
   y = cos( x );
   printf( "cos( %f ) = %f\n", x, y );
}
sin( 1.570796 ) = 1.000000
cos( 1.570796 ) = 0.000000

참고 항목

수학 및 부동 소수점 지원
acos, acosf, acosl
asin, asinf, asinl
atan, atanf, atanl, atan2, atan2f, atan2l
cos, cosf, cosl
tan, tanf, tanl
_CIsin