該函數計算以弧度給出的角度的雙曲餘弦值。
數學上
cosx = ex+ e-x/2
用法
假設雙曲角為 'x':
float cosh(float x);
double cosh(double x);
long double cosh(long double x);
double cosh(integral x);
參數
x:要計算其雙曲餘弦的角度值。
返回值
它返回以弧度給出的角度的雙曲餘弦值。
例子1
當 x 的值是整數類型時,讓我們看一個簡單的例子。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int x=45;
float radian=x*3.14/180;
std::cout << "Value of degree is:" <<x<<std::endl;
cout<<"cosh(radian):"<<cosh(radian);
return 0;
}
輸出:
Value of degree is:45 cosh(radian):1.32426
在此示例中,cosh() 計算角度 45 的雙曲餘弦值並返回值 1.324。
例子2
讓我們看另一個簡單的例子。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float x=25.5;
float radian=x*3.14/180;
std::cout << "Value of degree is:" << x<<std::endl;
cout<<"cosh(radian):"<<cosh(radian);
return 0;
}
輸出:
Value of degree is:25.5 cosh(radian):1.10058
相關用法
- C++ Math cos()用法及代碼示例
- C++ Math copysign()用法及代碼示例
- C++ Math ceil()用法及代碼示例
- C++ Math cbrt()用法及代碼示例
- C++ Math scalbn()用法及代碼示例
- C++ Math acosh()用法及代碼示例
- C++ Math asinh()用法及代碼示例
- C++ Math isgreater()用法及代碼示例
- C++ Math fabs()用法及代碼示例
- C++ Math islessgreater()用法及代碼示例
- C++ Math log2()用法及代碼示例
- C++ Math nearbyint()用法及代碼示例
- C++ Math tan()用法及代碼示例
- C++ Math log()用法及代碼示例
- C++ Math nextafter()用法及代碼示例
- C++ Math fdim()用法及代碼示例
- C++ Math isfinite()用法及代碼示例
- C++ Math erfc()用法及代碼示例
- C++ Math sinh()用法及代碼示例
- C++ Math scalbln()用法及代碼示例
注:本文由純淨天空篩選整理自 C++ Math cosh()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。