計算雙曲餘弦。
語法
double cosh( double x );
float coshf( float x );
long double coshl( long double x );
#define cosh(X) // Requires C11 or later
float cosh( float x ); // C++ only
long double cosh( long double x ); // C++ only
參數
x
角度 (弧度)。
傳回值
x的雙曲線餘弦函數。
根據預設,如果 cosh、coshf 或 coshl 呼叫中的結果太大,則此函式會傳回 HUGE_VAL,並將 errno 設為 ERANGE。
| 輸入 | SEH 例外狀況 | _matherr 例外 |
|---|---|---|
| ± QNaN,IND | none | _DOMAIN |
x ≥ 7.104760e+002 |
INEXACT+OVERFLOW |
OVERFLOW |
備註
因為 C++ 允許多載,所以您可以呼叫採用並傳回 cosh 或 float 值的 long double 的多載。 在 C 程式中,除非您使用 <tgmath.h> 巨集來呼叫此函式, cosh 否則一律會採用並傳 double回 。
如果您使用 中的cosh<tgmath.h>巨集,自變數的類型會決定選取哪一個函式版本。 如需詳細資料,請參閱型別泛型數學。
根據預設,此函式的全域狀態會限定於應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
需求
| 常式 | 必要的標頭 (C) | 必要的標頭 (C++) |
|---|---|---|
coshf、 、 coslcoshl |
<math.h> |
<cmath> 或 <math.h> |
coshf 巨集 |
<tgmath.h> |
如需相容性詳細資訊,請參閱相容性。
範例
請參閱、 sinhlsinhf中的sinh範例。
另請參閱
數學與浮點支援
acosh、 、 acoshfacoshl
asinh、 、 asinhfasinhl
atanh、 、 atanhfatanhl
_matherr
sinh、 、 sinhfsinhl
tanh、 、 tanhftanhl