函式
<cmath> <ctgmath>

acosh

     double acosh  (double x);      float acoshf (float x);long double acoshl (long double x);
     double acosh (double x);      float acosh (float x);long double acosh (long double x);     double acosh (T x);           // additional overloads for integral types
計算反雙曲餘弦
返回x的非負反雙曲餘弦。

反雙曲餘弦雙曲餘弦的逆運算。

標頭檔案 <tgmath.h> 提供了此函式的型別通用宏版本。
在此標頭檔案(<cmath>)中為整數型別提供了附加過載:這些過載會有效地將x強制轉換為double再進行計算(針對T是任何整數型別定義)。

此函式也在<complex>中過載(請參閱 complex acosh)。

引數

x
計算其反雙曲餘弦的值。
如果引數小於1,則會發生定義域錯誤

返回值

x的非負反雙曲餘弦,在區間[0,+INFINITY]內。
請注意,該值的負值也是x的有效反雙曲餘弦
如果發生定義域錯誤
- 並且 math_errhandling 設定了 MATH_ERRNO:全域性變數 errno 會被設定為 EDOM
- 並且 math_errhandling 設定了 MATH_ERREXCEPT:將引發 FE_INVALID

示例

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

int main ()
{
  double param, result;
  param = exp(2) - sinh(2);
  result = acosh(param) ;
  printf ("The area hyperbolic cosine of %f is %f radians.\n", param, result);
  return 0;
}

輸出

The area hyperbolic cosine of 3.762196 is 2.000000 radians.


另見