Share via


atanh, atanhf, atanhl

計算反雙曲正切。

語法

double atanh( double x );
float atanhf( float x );
long double atanhl( long double x );
#define atanh(X) // Requires C11 or higher

float atanh( float x );  // C++ only
long double atanh( long double x );  // C++ only

參數

x
浮點值。

傳回值

函式會 atanh 傳回 的 x 反雙曲正切值(弧線雙曲正切值)。 如果 x 大於 1 或小於 -1,則會設定為 EDOMerrno 而結果會是無訊息的 NaN。 若 x 等於 1 或 -1,則會分別傳回無限大的正數或負數,且 errno 會設為 ERANGE

輸入 SEH 例外狀況 _matherr 例外
± QNaN,IND none none
X ≥ 1; x ≤ -1 none none

備註

因為 C++ 允許多載,所以您可以呼叫採用並傳回 atanhfloat 值的 long double 的多載。 在 C 程式中,除非您使用 < tgmath.h > 宏來呼叫此函式, atanh 否則一律會採用 並傳 double 回 。

如果您使用 < tgmath.h >atanh() 宏,引數的類型會決定選取哪一個函式版本。 如需詳細資訊,請參閱 類型泛型數學

根據預設,此函式的全域狀態會限定于應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。

需求

函式 C 標頭 C++ 標頭
atanh, atanhf, atanhl <math.h> <cmath > 或 < math.h>
atanh 宏觀 <tgmath.h>

如需相容性詳細資訊,請參閱相容性

範例

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

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

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

   x = tanh( pi / 4 );
   y = atanh( x );
   printf( "tanh( %f ) = %f\n", pi/4, x );
   printf( "atanh( %f ) = %f\n", x, y );
}
tanh( 0.785398 ) = 0.655794
atanh( 0.655794 ) = 0.785398

另請參閱

數學和浮點支援
acosh, acoshf, acoshl
asinh, asinhf, asinhl
cosh, coshf, coshl
sinh, sinhf, sinhl
tanh, tanhf, tanhl