cosh, coshf, coshl
提供: cppreference.com
ヘッダ <math.h> で定義
|
||
float coshf( float arg ); |
(1) | (C99以上) |
double cosh( double arg ); |
(2) | |
long double coshl( long double arg ); |
(3) | (C99以上) |
ヘッダ <tgmath.h> で定義
|
||
#define cosh( arg ) |
(4) | (C99以上) |
1-3)
arg
の双曲線余弦を計算します。4) 型総称マクロ。 引数が long double 型の場合は
coshl
が呼ばれます。 そうでなく、引数が整数型または double 型の場合は cosh
が呼ばれます。 そうでなければ coshf
が呼ばれます。 引数が複素数の場合、マクロは対応する複素数の関数 (ccoshf, ccosh, ccoshl) を呼びます。目次 |
[編集] 引数
arg | - | 双曲角を表す浮動小数点値 |
[編集] 戻り値
エラーが発生しなければ、arg
の双曲線余弦 (cosh(arg) または earg +e-arg |
2 |
オーバーフローによる値域エラーが発生した場合、 +HUGE_VAL
、 +HUGE_VALF
または +HUGE_VALL
が返されます。
[編集] ��ラー処理
math_errhandling で規定されている通りにエラーが報告されます。
処理系が IEEE 浮動小数点算術 (IEC 60559) をサポートしている場合、
- 引数が ±0 であれば、 1 が返されます。
- 引数が ±∞ であれば、 +∞ が返されます。
- 引数が NaN であれば、 NaN が返されます。
[編集] ノート
IEEE 互換な double 型の場合、 |arg| > 710.5 であれば cosh(arg)
はオーバーフローします。
[編集] 例
Run this code
#include <stdio.h> #include <math.h> #include <errno.h> #include <fenv.h> #pragma STDC FENV_ACCESS ON int main(void) { printf("cosh(1) = %f\ncosh(-1)= %f\n", cosh(1), cosh(-1)); printf("log(sinh(1) + cosh(1))=%f\n", log(sinh(1)+cosh(1))); // special values printf("cosh(+0) = %f\ncosh(-0) = %f\n", cosh(0.0), cosh(-0.0)); // error handling errno=0; feclearexcept(FE_ALL_EXCEPT); printf("cosh(710.5) = %f\n", cosh(710.5)); if(errno == ERANGE) perror(" errno == ERANGE"); if(fetestexcept(FE_OVERFLOW)) puts(" FE_OVERFLOW raised"); }
出力例:
cosh(1) = 1.543081 cosh(-1)= 1.543081 log(sinh(1) + cosh(1))=1.000000 cosh(+0) = 1.000000 cosh(-0) = 1.000000 cosh(710.5) = inf errno == ERANGE: Numerical result out of range FE_OVERFLOW raised
[編集] 参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.12.5.4 The cosh functions (p: 241)
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
- F.10.2.4 The cosh functions (p: 520)
- C99 standard (ISO/IEC 9899:1999):
- 7.12.5.4 The cosh functions (p: 222)
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
- F.9.2.4 The cosh functions (p: 457)
- C89/C90 standard (ISO/IEC 9899:1990):
- 4.5.3.1 The cosh function
[編集] 関連項目
(C99)(C99) |
双曲線正弦 (sinh(x)) を計算します (関数) |
(C99)(C99) |
双曲線正接 (tanh(x)) を計算します (関数) |
(C99)(C99)(C99) |
逆双曲線余弦 (arcosh(x)) を計算します (関数) |
(C99)(C99)(C99) |
複素数双曲線余弦を計算します (関数) |
cosh の C++リファレンス
|