tanh, tanhf, tanhl

쌍곡 탄젠트를 계산합니다.

구문

double tanh( double x );
float tanhf( float x );
long double tanhl( long double x );
#define tanh(x) // Requires C11 or higher
float tanh( float x );  // C++ only
long double tanh( long double x );  // C++ only

매개 변수

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

반환 값

tanh 함수는 x의 쌍곡선 탄젠트를 반환합니다. 오류 반환이 없습니다.

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

설명

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

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

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

요구 사항

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

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

예시

// crt_tanh.c
// This program displays the tangent of pi / 4
// and the hyperbolic tangent of the result.
// Compile by using: cl crt_tanh.c

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

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

   x = tan( pi / 4 );
   y = tanh( x );
   printf( "tan( %f ) = %f\n", pi/4, x );
   printf( "tanh( %f ) = %f\n", x, y );
}
tan( 0.785398 ) = 1.000000
tanh( 1.000000 ) = 0.761594

참고 항목

수학 및 부동 소수점 지원
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
sinh, sinhf, sinhl