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 尋找

_DOMAIN

± ∞ (tan, tanf)

INVALID

_DOMAIN

tanh傳回一數值的雙曲線正切值x。沒有任何錯誤傳回。

備註

C + + 允許多載化,因此使用者可以呼叫多載的tan和tanh ,接受浮點數或長雙精度浮點型別。在某 c 程式, tan和tanh函式永遠取得,並傳回雙精度浮點。

需求

常式

所需的標頭

tan, tanf, tanh, tanhf

<math.h>

其他的相容性資訊,請參閱相容性在簡介中。

範例

// 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 對等用法

請參閱

參考

浮點支援

長雙

acos acosf

asin asinf

atan、 atanf、 atan2、 atan2f

cos,cosf,cosh、 coshf

sin、 sinf、 sinh、 sinhf

_CItan