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>

互換性の詳細については、「 Compatibility」を参照してください。

// 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