언어 자료구조 알고리즘/C11 표준 라이브러리 함수

TAN, TANF, TANL

언제나휴일 2016. 1. 3. 16:15
반응형
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
반응형

'언어 자료구조 알고리즘 > C11 표준 라이브러리 함수' 카테고리의 다른 글

FREXP, FREXPF, FREXPL  (0) 2016.01.03
MODF, MODFF, MODFL  (0) 2016.01.03
LOG, LOGF, LOGL  (0) 2016.01.03
LDEXP, LDEXPF, LDEXPL  (0) 2016.01.03
LOG1P, LOG1PF, LOG1PL  (0) 2016.01.03
SIN, SINF, SINL  (0) 2016.01.03
COS, COSF, COSL  (0) 2016.01.03
ATAN2, ATAN2F, ATAN2L  (0) 2016.01.03
ATAN, ATANF, ATANL  (0) 2016.01.03
ASIN, ASINF, ASINL  (0) 2016.01.03