tan, tanf, tanl 함수

double tan(double x); tangent 계산

float tanf(float x); tangent 계산

long double tanl(long double x); tangent 계산

입력 매개 변수 리스트

x radian

반환 값

tangent 값

사용 예

//C언어 표준 라이브러리 함수 가이드
//double tan(double x); tangent 계산
//float tanf(float x); tangent 계산
//long double tanl(long double x); tangent 계산
//0, 30, 45, 60, 90도의 tangent 값

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

int main(void)
{
    double radian;
    radian = 0.0;
    printf("%f 도\n", radian * 180 / 3.141592);
    printf("tan(%f)  = %.30f\n", radian, tan(radian));
    printf("tanf(%f) = %.30f\n", radian, tanf((float)radian));
    printf("tanl(%f) = %.30f\n", radian, tanl(radian));

    radian = 30 * 3.141592 / 180;
    printf("%f 도\n", radian * 180 / 3.141592);
    printf("tan(%f)  = %.30f\n", radian, tan(radian));
    printf("tanf(%f) = %.30f\n", radian, tanf((float)radian));
    printf("tanl(%f) = %.30f\n", radian, tanl(radian));

    radian = 45 * 3.141592 / 180;
    printf("%f 도\n", radian * 180 / 3.141592);
    printf("tan(%f)  = %.30f\n", radian, tan(radian));
    printf("tanf(%f) = %.30f\n", radian, tanf((float)radian));
    printf("tanl(%f) = %.30f\n", radian, tanl(radian));

    radian = 60 * 3.141592 / 180;
    printf("%f 도\n", radian * 180 / 3.141592);
    printf("tan(%f)  = %.30f\n", radian, tan(radian));
    printf("tanf(%f) = %.30f\n", radian, tanf((float)radian));
    printf("tanl(%f) = %.30f\n", radian, tanl(radian));

    radian = 90 * 3.141592 / 180;
    printf("%f 도\n", radian * 180 / 3.141592);
    printf("tan(%f)  = %.30f\n", radian, tan(radian));
    printf("tanf(%f) = %.30f\n", radian, tanf((float)radian));
    printf("tanl(%f) = %.30f\n", radian, tanl(radian));

    return 0;
}

출력

0.000000 도
tan(0.000000)  = 0.000000000000000000000000000000
tanf(0.000000) = 0.000000000000000000000000000000
tanl(0.000000) = 0.000000000000000000000000000000
30.000000 도
tan(0.523599)  = 0.577350123947458659934284241899
tanf(0.523599) = 0.577350139617919921875000000000
tanl(0.523599) = 0.577350123947458659934284241899
45.000000 도
tan(0.785398)  = 0.999999673205156813793337278184
tanf(0.785398) = 0.999999701976776123046875000000
tanl(0.785398) = 0.999999673205156813793337278184
60.000000 도
tan(1.047197)  = 1.732049936116148325382368966530
tanf(1.047197) = 1.732049942016601562500000000000
tanl(1.047197) = 1.732049936116148325382368966530
90.000000 도
tan(1.570796)  = 3060023.306952843908220529556274414063
tanf(1.570796) = 3185560.750000000000000000000000000000
tanl(1.570796) = 3060023.306952843908220529556274414063