atan, atanf, atanl, atan2, atan2f, atan2l

x(atan, atanfatanl) 또는 y/x(atan2, atan2fatan2l)의 아크탄젠트를 계산합니다.

구문

double atan( double x );
float atanf( float x );
long double atanl( long double x );
#define atan(X) // Requires C11 or higher

float atan( float x );  // C++ only
long double atan( long double x );  // C++ only

double atan2( double y, double x );
float atan2f( float y, float x );
long double atan2l( long double y, long double x );
#define atan2(Y, X) // Requires C11 or higher

float atan2( float y, float x );  // C++ only
long double atan2( long double y, long double x );  // C++ only

매개 변수

x, y
임의의 숫자입니다.

반환 값

atan 는 -π/2에서 π/2 라디안 범위의 x 아크탄젠트를 반환합니다. atan2 는 -π 범위의 y/x 아크탄젠트를 π 라디안으로 반환합니다. x가 0이면 atan은 0을 반환합니다. atan2의 두 매개 변수가 0이면 함수는 0을 반환합니다. 모든 결과는 라디안 단위입니다.

atan2는 두 매개 변수의 기호를 사용하여 반환 값의 사분면을 결정합니다.

입력 SEH 예외 _matherr 예외
± QNaN, IND 없음 _DOMAIN

설명

atan 함수는 x의 아크탄젠트(역 탄젠트 함수)를 계산합니다. atan2y/x의 아크탄젠트를 계산합니다(x가 0과 같은 경우, y가 양수이면 atan2는 π/2, y가 음수이면 -π/2, y가 0이면 0을 반환).

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

atan에는 SSE2(스트리밍 SIMD 확장 2)를 사용하는 구현이 포함됩니다. SSE2 구현 사용에 대한 자세한 내용 및 제한 사항은 다음을 참조하세요 _set_SSE2_enable.

C++는 오버로드를 허용하므로 오버로드 및 atan2 해당 인수 floatatan 호출할 long double 수 있습니다. C 프로그램에서 매크로를 사용하여 이 함수를 <tgmath.h> 호출하고 atan2 항상 인수를 가져와 double 서 반환하지 않는 한 double. atan

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

요구 사항

루틴에서 반환된 값 필수 헤더(C) 필수 헤더(C++)
atan, atan2, atanf, atan2f, atanl, atan2l <math.h> <cmath> 또는 <math.h>
atan, atan2 매크로 <tgmath.h>

예시

// crt_atan.c
// arguments: 5 0.5
#include <math.h>
#include <stdio.h>
#include <errno.h>

int main( int ac, char* av[] )
{
   double x, y, theta;
   if( ac != 3 ){
      fprintf( stderr, "Usage: %s <x> <y>\n", av[0] );
      return 1;
   }
   x = atof( av[1] );
   theta = atan( x );
   printf( "Arctangent of %f: %f\n", x, theta );
   y = atof( av[2] );
   theta = atan2( y, x );
   printf( "Arctangent of %f / %f: %f\n", y, x, theta );
   return 0;
}
Arctangent of 5.000000: 1.373401
Arctangent of 0.500000 / 5.000000: 0.099669

참고 항목

수학 및 부동 소수점 지원
acos, acosf, acosl
asin, asinf, asinl
cos, cosf, cosl
_matherr
sin, sinf, sinl
tan, tanf, tanl
_CIatan
_CIatan2