English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C++ sinh() 函数使用方法及示例

C++ Fonction de bibliothèque <cmath>

C ++中的sinh()函数返回以弧度表示的角度的双曲正弦值。

该函数在<cmath>头文件中定义。

[Mathematics] sinh x = sinh(x) [ C++]

sinh()原型[从C ++ 11标准开始]

double sinh(double x);
float sinh(float x);
long double sinh(long double x);
double sinh(T x); //为整型。

sinh()函数接受一个弧度参数,并以double、float或long double类型返回该角度的双曲正弦值。

x的双曲正弦由下式给出:

sinh()参数

sinh()函数采用单个强制性参数,以弧度表示双曲角。

sinh()返回值

sinh()函数返回参数的双曲正弦值。

如果结果的大小太大而无法用返回类型的值表示,则该函数将返回带有正确符号的HUGE_VAL,并且会发生溢出范围错误。

Exemple1:sinh()函数如何工作?

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    double x = 3.55, result;
    result = sinh(x);
    cout << "sinh(x) = " << result << endl;
    double xDegrees = 90;
    x = xDegrees * 3.14159/180;
    result = sinh(x);
    cout << "sinh(x) = " << result << endl;
    return 0;
}

La sortie lors de l'exécution du programme est :

sinh(x) = 17.3923
sinh(x) = 2.3013

Exemple2:具有整数类型的sinh()函数

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
    int x = -3;
    double result;
    result = sinh(x);
    cout << "sinh(x) = " << result << endl;
    return 0;
}

La sortie lors de l'exécution du programme est :

sinh(x) = -10.0179

C++ Fonction de bibliothèque <cmath>