函式
<cmath> <ctgmath>

atanh

     double atanh  (double x);      float atanhf (float x);long double atanhl (long double x);
     double atanh (double x);      float atanh (float x);long double atanh (long double x);     double asinh (T x);           // additional overloads for integral types
計算反雙曲正切
返回 x 的反雙曲正切。

反雙曲正切雙曲正切的反函式。

標頭檔案 <tgmath.h> 提供了此函式的型別通用宏版本。
此標頭檔案 (<cmath>) 中為整型提供了額外的過載:這些過載在計算前有效地將 x 轉換為 double(定義為 T 是任何整型)。

該函式在 <complex> 中也有過載(請參閱 complex atanh)。

引數

x
計算其反雙曲正切的值,區間為 [-1,+1]
如果引數超出此區間,則會發生定義域錯誤
對於 -1+1 的值,可能會發生極點錯誤

返回值

x 的反雙曲正切。

如果發生定義域錯誤
- 並且 math_errhandling 設定了 MATH_ERRNO:全域性變數 errno 會被設定為 EDOM
- 並且 math_errhandling 設定了 MATH_ERREXCEPT:將引發 FE_INVALID

如果發生極點錯誤
- 並且 math_errhandling 設定了 MATH_ERRNO:全域性變數 errno 被設定為 ERANGE
- 並且 math_errhandling 設定了 MATH_ERREXCEPT:將引發 FE_DIVBYZERO

示例

1
2
3
4
5
6
7
8
9
10
11
12
/* atanh example */
#include <stdio.h>      /* printf */
#include <math.h>       /* tanh, atanh */

int main ()
{
  double param, result;
  param = tanh(1);
  result = atanh(param) ;
  printf ("The area hyperbolic tangent of %f is %f.\n", param, result);
  return 0;
}

輸出

The area hyperbolic tangent of 0.761594 is 1.000000.


另見