tan、tanf、tanh、tanhf

タンジェント (tan または tanf) またはハイパーボリック タンジェント (双曲線正接) (tanh または tanhf) を計算します。

double tan(
   double x 
);
float tan(
   float x 
);  // C++ only
long double tan(
   long double x
);  // C++ only
float tanf(
   float x 
);
double tanh(
   double x 
);
float tanh(
   float x 
);  // C++ only
long double tanh(
   long double x
);  // C++ only
float tanhf(
   float x 
);

パラメーター

  • x
    角度 (ラジアン)。

戻り値

tan は、x のタンジェントを返します。 x が 263 以上または –263 以下の場合、計算結果の有効桁の一部が失われます。

入力

SEH 例外

Matherr 例外

± QNAN、IND

[none]

_DOMAIN

± ∞ (tan, tanf)

INVALID

_DOMAIN

tanh は、x のハイパーボリック タンジェントを返します。 エラーの戻り値はありません。

解説

C++ ではオーバーロードが可能であるため、float 型または long double 型を受け取る tan と tanh のオーバーロードを呼び出すことができます。 C プログラムでは、tan と tanh 関数は常に倍精度浮動小数点数を受け取り、倍精度浮動小数点数を返します。

必要条件

ルーチン

必須ヘッダー

tan, tanf, tanh, tanhf

<math.h>

互換性の詳細については、「C ランタイム ライブラリ」の「互換性」を参照してください。

使用例

// crt_tan.c
// This program displays the tangent of pi / 4
// and the hyperbolic tangent of the result.
//

#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 );
}
  

同等の .NET Framework 関数

参照

参照

浮動小数点サポート

Long Double 型

acos、acosf

asin、asinf

atan、atanf、atan2、atan2f

cos、cosf、cosh、coshf

sin、sinf、sinh、sinhf

その他の技術情報

_CItan