名前空間
変種
操作

cosh, coshf, coshl

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
共通の数学関数
関数
基本的な数学関数
(C99)
(C99)
(C99)
(C99)(C99)(C99)(C23)
最大/最小演算
(C99)
(C99)
指数関数
(C23)
(C99)
(C99)
(C23)
(C23)

(C99)
(C99)(C23)
(C23)
(C23)
べき乗関数
(C99)
(C23)
(C23)

(C99)
(C23)
(C23)
三角関数と双曲線関数
(C23)
(C23)
(C23)
(C23)
cosh
(C99)
(C99)
(C99)
最も近い整数浮動小数点数
(C99)(C99)(C99)
(C99)

(C99)(C99)(C99)
(C23)(C23)(C23)(C23)
浮動小数点操作
(C99)(C99)
(C99)(C23)
(C99)
縮小演算
(C23)
(C23)
(C23)
(C23)
(C23)
(C23)
量子および量子指数
Decimal再エンコーディング関数
総順序およびペイロード関数
分類
(C99)
(C99)
(C99)
(C23)
誤差関数とガンマ関数
(C99)
(C99)
(C99)
(C99)
マクロ定数
特殊な浮動小数点値
(C99)(C23)
引数と戻り値
エラーハンドリング
高速演算インジケータ
 
ヘッダー <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 が呼び出されます。引数が複素数の場合、マクロは対応する複素数関数(ccoshfccoshccoshl)を呼び出します。

目次

[edit] パラメータ

arg - 双曲線角度を表す浮動小数点数

[edit] 戻り値

エラーが発生しない場合、arg の双曲線余弦(cosh(arg)、または
earg
+e-arg
2
)を返します。

オーバーフローによる範囲エラーが発生した場合、+HUGE_VAL+HUGE_VALF、または +HUGE_VALL が返されます。

[edit] エラー処理

エラーは math_errhandling で指定されたとおりに報告されます。

実装がIEEE浮動小数点算術 (IEC 60559) をサポートしている場合、

  • 引数が ±0 の場合、1 を返します。
  • 引数が ±∞ の場合、+∞ を返します。
  • 引数が NaN の場合、NaN を返します。

[edit] 注記

IEEE 互換の double 型の場合、|arg| > 710.5 であると、cosh(arg) はオーバーフローします。

[edit]

#include <errno.h>
#include <fenv.h>
#include <math.h>
#include <stdio.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

[edit] 参照

  • C23標準 (ISO/IEC 9899:2024)
  • 7.12.5.4 The cosh functions (p: TBD)
  • 7.25 Type-generic math <tgmath.h> (p: TBD)
  • F.10.2.4 The cosh functions (p: TBD)
  • C17標準 (ISO/IEC 9899:2018)
  • 7.12.5.4 The cosh functions (p: 176)
  • 7.25 型総称数学関数 <tgmath.h> (p: 272-273)
  • F.10.2.4 The cosh functions (p: 379)
  • C11標準 (ISO/IEC 9899:2011)
  • 7.12.5.4 The cosh functions (p: 241)
  • 7.25 型総称数学関数 <tgmath.h> (p: 373-375)
  • F.10.2.4 The cosh functions (p: 520)
  • C99標準 (ISO/IEC 9899:1999)
  • 7.12.5.4 The cosh functions (p: 222)
  • 7.22 型総称数学関数 <tgmath.h> (p: 335-337)
  • F.9.2.4 The cosh functions (p: 457)
  • C89/C90標準 (ISO/IEC 9899:1990)
  • 4.5.3.1 The cosh function

[edit] 関連項目

(C99)(C99)
双曲線サインを計算する (sinh(x))
(関数) [編集]
(C99)(C99)
双曲線タンジェントを計算する (tanh(x))
(関数) [編集]
(C99)(C99)(C99)
逆双曲線コサインを計算する (arcosh(x))
(関数) [編集]
(C99)(C99)(C99)
複素双曲線コサインを計算する
(関数) [編集]
English 日本語 中文(简体) 中文(繁體)