acosh, acoshf, acoshl
來自 cppreference.com
定義於標頭檔案 <math.h> |
||
float acoshf( float arg ); |
(1) | (C99 起) |
double acosh( double arg ); |
(2) | (C99 起) |
long double acoshl( long double arg ); |
(3) | (C99 起) |
定義於標頭檔案 <tgmath.h> |
||
#define acosh( arg ) |
(4) | (C99 起) |
1-3) 計算 arg 的反雙曲餘弦。
4) 泛型宏:如果引數型別為 long double,則呼叫
acoshl
。否則,如果引數為整型或 double 型別,則呼叫 acosh
。否則,呼叫 acoshf
。如果引數為複數,則宏呼叫對應的複數函式(cacoshf、cacosh、cacoshl)。目錄 |
[編輯] 引數
arg | - | 表示雙曲扇形面積的浮點值 |
[編輯] 返回值
如果未發生錯誤,則返回 arg 的反雙曲餘弦(cosh-1
(arg) 或 arcosh(arg)),在區間 [0, +∞] 上。
如果發生域錯誤,則返回實現定義的值 (支援 NaN 時返回 NaN)。
[編輯] 錯誤處理
錯誤按 math_errhandling
中指定的方式報告。
如果引數小於 1,則發生域錯誤。
如果實現支援 IEEE 浮點運算 (IEC 60559),
- 如果引數小於 1,則引發 FE_INVALID 並返回 NaN。
- 若引數為 1,則返回 +0。
- 如果引數是 +∞,則返回 +∞。
- 如果引數為 NaN,則返回 NaN。
[編輯] 注意
儘管 C 標準將此函式命名為“反雙曲餘弦”(arc hyperbolic cosine),但雙曲函式的反函式是面積函式。它們的引數是雙曲扇形的面積,而不是弧。正確的名稱是“反雙曲餘弦”(inverse hyperbolic cosine,POSIX 使用)或“面積雙曲餘弦”(area hyperbolic cosine)。
[編輯] 示例
執行此程式碼
#include <errno.h> #include <fenv.h> #include <float.h> #include <math.h> #include <stdio.h> // #pragma STDC FENV_ACCESS ON int main(void) { printf("acosh(1) = %f\nacosh(10) = %f\n", acosh(1), acosh(10)); printf("acosh(DBL_MAX) = %f\nacosh(Inf) = %f\n", acosh(DBL_MAX), acosh(INFINITY)); // error handling errno = 0; feclearexcept(FE_ALL_EXCEPT); printf("acosh(0.5) = %f\n", acosh(0.5)); if (errno == EDOM) perror(" errno == EDOM"); if (fetestexcept(FE_INVALID)) puts(" FE_INVALID raised"); }
可能的輸出
acosh(1) = 0.000000 acosh(10) = 2.993223 acosh(DBL_MAX) = 710.475860 acosh(Inf) = inf acosh(0.5) = -nan errno == EDOM: Numerical argument out of domain FE_INVALID raised
[編輯] 參考
- C23 標準 (ISO/IEC 9899:2024)
- 7.12.5.1 acosh 函式(p: 待定)
- 7.27 泛型數學 <tgmath.h>(p: 待定)
- F.10.2.1 acosh 函式(p: 待定)
- C17 標準 (ISO/IEC 9899:2018)
- 7.12.5.1 acosh 函式(p: 175)
- 7.25 型別通用數學 <tgmath.h> (p: 272-273)
- F.10.2.1 acosh 函式(p: 379)
- C11 標準 (ISO/IEC 9899:2011)
- 7.12.5.1 acosh 函式(p: 240)
- 7.25 型別通用數學 <tgmath.h> (p: 373-375)
- F.10.2.1 acosh 函式(p: 520)
- C99 標準 (ISO/IEC 9899:1999)
- 7.12.5.1 acosh 函式(p: 221)
- 7.22 型別通用數學 <tgmath.h> (p: 335-337)
- F.9.2.1 acosh 函式(p: 457)
[編輯] 另請參閱
(C99)(C99)(C99) |
計算反雙曲正弦 (arsinh(x)) (函式) |
(C99)(C99)(C99) |
計算反雙曲正切 (artanh(x)) (函式) |
(C99)(C99) |
計算雙曲餘弦 (cosh(x)) (函式) |
(C99)(C99)(C99) |
計算復反雙曲餘弦 (函式) |
C++ 文件 for acosh
|
[編輯] 外部連結
Weisstein, Eric W. "反雙曲餘弦。" 來自 MathWorld — Wolfram Web 資源。 |