C ++中的sinh()函數(shù)返回以弧度表示的角度的雙曲正弦值。
該函數(shù)在<cmath>頭文件中定義。
[Mathematics] sinh x = sinh(x) [ C++]
double sinh(double x); float sinh(float x); long double sinh(long double x); double sinh(T x); //為整型。
sinh()函數(shù)接受一個(gè)弧度參數(shù),并以double、float或long double類(lèi)型返回該角度的雙曲正弦值。
x的雙曲正弦由下式給出:
sinh()函數(shù)采用單個(gè)強(qiáng)制性參數(shù),以弧度表示雙曲角。
sinh()函數(shù)返回參數(shù)的雙曲正弦值。
如果結(jié)果的大小太大而無(wú)法用返回類(lèi)型的值表示,則該函數(shù)將返回帶有正確符號(hào)的HUGE_VAL,并且會(huì)發(fā)生溢出范圍錯(cuò)誤。
#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; }
運(yùn)行該程序時(shí),輸出為:
sinh(x) = 17.3923 sinh(x) = 2.3013
#include <iostream> #include <cmath> using namespace std; int main() { int x = -3; double result; result = sinh(x); cout << "sinh(x) = " << result << endl; return 0; }
運(yùn)行該程序時(shí),輸出為:
sinh(x) = -10.0179