atan, atanf, atanl 함수

double atan(double x); arc tangent 계산

float atanf(float x); arc tangent 계산

long double atanl(long double x); arc tangent 계산

입력 매개 변수 리스트

x tangent 값

반환 값

arc tangent 값

사용 예

//C언어 표준 라이브러리 함수 가이드
//double atan(double x); arc tangent 계산
//float atanf(float x); arc tangent 계산
//long double atanl(long double x); arc tangent 계산
//0,  pi/4, pi/2의 tangent 값과 tangent값의 atangent 값 출력

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

int main(void)
{
    double value;
    value = tan(0.0);
    printf("tan(%f)  = %f\n", 0.0, value);
    printf("atan(%f) = %.30f\n", value, atan(value));
    printf("atanf(%f) = %.30f\n", value, atanf((float)value));
    printf("atanl(%f) = %.30f\n", value, atanl(value));
    value = tan(3.141592 / 4);
    printf("tan(%f)  = %f\n", 3.141592 / 4, value);
    printf("atan(%f) = %.30f\n", value, atan(value));
    printf("atanf(%f) = %.30f\n", value, atanf((float)value));
    printf("atanl(%f) = %.30f\n", value, atanl(value));
    value = tan(3.141592 / 2);
    printf("tan(%f)  = %f\n", 3.141592 / 2, value);
    printf("atan(%f) = %.30f\n", value, atan(value));
    printf("atanf(%f) = %.30f\n", value, atanf((float)value));
    printf("atanl(%f) = %.30f\n", value, atanl(value));
    return 0;
}

출력

tan(0.000000)  = 0.000000
atan(0.000000) = 0.000000000000000000000000000000
atanf(0.000000) = 0.000000000000000000000000000000
atanl(0.000000) = 0.000000000000000000000000000000
tan(0.785398)  = 1.000000
atan(1.000000) = 0.785398000000000040543568502471
atanf(1.000000) = 0.785398006439208984375000000000
atanl(1.000000) = 0.785398000000000040543568502471
tan(1.570796)  = 3060023.306953
atan(3060023.306953) = 1.570796000000000081087137004943
atanf(3060023.306953) = 1.570796012878417968750000000000
atanl(3060023.306953) = 1.570796000000000081087137004943