tan
, tanf
, tanl
タンジェントを計算します。
構文
double tan( double x );
float tanf( float x );
long double tanl( long double x );
#define tan(x) // Requires C11 or higher
float tan( float x ); // C++ only
long double tan( long double x ); // C++ only
パラメーター
x
角度 (ラジアン)。
戻り値
tan
関数は、x
のタンジェントを返します。 x
が 263 以上、または -263 以下の場合、結果で桁落ちが発生します。
入力 | SEH 例外 | _matherr 例外 |
---|---|---|
± QNaN、IND | なし | _DOMAIN |
± INF | INVALID |
_DOMAIN |
解説
C++ ではオーバーロードが可能であるため、tan
または float
の値を受け取って返す long double
のオーバーロードを呼び出すことができます。 C プログラムでは、この関数を呼び出すために <tgmath.h>
マクロが使用されていない限り、tan
は常に double
を受け取って返します。
マクロを<tgmath.h>
使用するtan
場合は、引数の型によって、どのバージョンの関数が選択されているかが決まります。 詳細については、「ジェネリック型数値演算」を参照してください。
既定では、この関数のグローバル状態の適用対象は、アプリケーションになります。 この動作を変更するには、「CRT のグローバル状態」を参照してください。
必要条件
ルーチンによって返される値 | 必須ヘッダー (C) | 必須ヘッダー (C++) |
---|---|---|
tan , tanf , tanl |
<math.h> |
<cmath> または <math.h> |
tan マクロ |
<tgmath.h> |
互換性の詳細については、「 Compatibility」を参照してください。
例
// crt_tan.c
// This program displays the tangent of pi / 4
// Compile by using: cl crt_tan.c
#include <math.h>
#include <stdio.h>
int main( void )
{
double pi = 3.1415926535;
double x;
x = tan( pi / 4 );
printf( "tan( %f ) = %f\n", pi/4, x );
}
tan( 0.785398 ) = 1.000000
関連項目
数学と浮動小数点のサポート
acos
, acosf
, acosl
asin
, asinf
, asinl
atan
, atanf
, atanl
, atan2
, atan2f
, atan2l
cos
, cosf
, cosl
sin
, sinf
, sinl
_CItan
フィードバック
https://aka.ms/ContentUserFeedback」を参照してください。
以下は間もなく提供いたします。2024 年を通じて、コンテンツのフィードバック メカニズムとして GitHub の issue を段階的に廃止し、新しいフィードバック システムに置き換えます。 詳細については、「フィードバックの送信と表示