Namespaces
Variants

std:: sinh, std:: sinhf, std:: sinhl

From cppreference.net
Common mathematical functions
Nearest integer floating point operations
(C++11)
(C++11)
(C++11) (C++11) (C++11)
Floating point manipulation functions
(C++11) (C++11)
(C++11)
(C++11)
Classification and comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Types
(C++11)
(C++11)
(C++11)
Macro constants
ヘッダーで定義 <cmath>
(1)
float sinh ( float num ) ;

double sinh ( double num ) ;

long double sinh ( long double num ) ;
(C++23まで)
/*floating-point-type*/
sinh ( /*floating-point-type*/ num ) ;
(C++23から)
(constexpr C++26から)
float sinhf ( float num ) ;
(2) (C++11から)
(constexpr C++26から)
long double sinhl ( long double num ) ;
(3) (C++11から)
(constexpr C++26から)
ヘッダーで定義 <simd>
template < /*math-floating-point*/ V >

constexpr /*deduced-simd-t*/ < V >

sinh ( const V & v_num ) ;
(S) (C++26から)
ヘッダーで定義 <cmath>
template < class Integer >
double sinh ( Integer num ) ;
(A) (constexpr C++26から)
1-3) num の双曲線正弦を計算する。 ライブラリは、パラメータの型としてすべてのcv修飾されない浮動小数点型に対する std::sinh のオーバーロードを提供する。 (C++23以降)
S) SIMDオーバーロードは v_num に対して要素ごとに std::sinh を実行します。
(詳細は math-floating-point および deduced-simd-t を参照)
(C++26以降)
A) すべての整数型に対して追加のオーバーロードが提供されており、これらは double として扱われます。
(C++11以降)

目次

パラメータ

num - 浮動小数点または整数値

戻り値

If no errors occur, the hyperbolic sine of num ( sinh(num) , or
e num
-e -num
2
) is returned.

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

アンダーフローによる範囲エラーが発生した場合、正しい結果(丸め後)が返されます。

エラーハンドリング

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

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

  • 引数が±0または±∞の場合、変更されずに返されます。
  • 引数がNaNの場合、NaNが返されます。

注記

POSIXは アンダーフローが発生した場合、 num が変更されずに返され、それがサポートされていない場合は、 DBL_MIN FLT_MIN 、および LDBL_MIN を超えない実装定義の値が返されることを規定しています。

追加のオーバーロードは (A) と完全に同一である必要はありません。それらは、整数型の引数 num に対して、 std :: sinh ( num ) std :: sinh ( static_cast < double > ( num ) ) と同じ効果を持つことを保証するのに十分であればよいのです。

#include <cerrno>
#include <cfenv>
#include <cmath>
#include <cstring>
#include <iostream>
// #pragma STDC FENV_ACCESS ON
int main()
{
    const double x = 42;
    std::cout << "sinh(1) = " << std::sinh(1) << '\n'
              << "sinh(-1) = " << std::sinh(-1) << '\n'
              << "log(sinh(" << x << ")+cosh(" << x << ")) = "
              << std::log(std::sinh(x) + std::cosh(x)) << '\n';
    // 特殊な値
    std::cout << "sinh(+0) = " << std::sinh(0.0) << '\n'
              << "sinh(-0) = " << std::sinh(-0.0) << '\n';
    // エラー処理
    errno = 0;
    std::feclearexcept(FE_ALL_EXCEPT);
    std::cout << "sinh(710.5) = " << std::sinh(710.5) << '\n';
    if (errno == ERANGE)
        std::cout << "    errno == ERANGE: " << std::strerror(errno) << '\n';
    if (std::fetestexcept(FE_OVERFLOW))
        std::cout << "    FE_OVERFLOW raised\n";
}

出力:

sinh(1) = 1.1752
sinh(-1) = -1.1752
log(sinh(42)+cosh(42)) = 42
sinh(+0) = 0
sinh(-0) = -0
sinh(710.5) = inf
    errno == ERANGE: 数値結果が範囲外です
    FE_OVERFLOW raised

関連項目

(C++11) (C++11)
双曲線余弦を計算する ( cosh(x) )
(関数)
(C++11) (C++11)
双曲線正接を計算する ( tanh(x) )
(関数)
(C++11) (C++11) (C++11)
逆双曲線正弦を計算する ( arsinh(x) )
(関数)
複素数の双曲線正弦を計算する ( sinh(z) )
(関数テンプレート)
関数 std::sinh をvalarrayの各要素に適用する
(関数テンプレート)