📅  最后修改于: 2020-09-25 07:20:30             🧑  作者: Mango
acosh() 函数采用单个参数,并以弧度返回该值的反双曲余弦值。
该函数在
[Mathematics] cosh-1x = acosh(x) [In C++ Programming]
double acosh(double x);
float acosh(float x);
long double acosh(long double x);
double acosh(T x); // For integral type
acosh() 函数采用单个强制性参数,该参数大于或等于1。
如果参数小于1,则发生域错误。
acosh() 函数返回[0,∞]范围内的值。
如果传递给acosh()的参数小于1,则返回NaN
(不是数字)。
Parameter | Return Value |
---|---|
x >= 1 | [0, ∞] |
x < 1 | NaN |
#include
#include
#define PI 3.141592654
using namespace std;
int main()
{
double x = 13.21, result;
result = acosh(x);
cout << "acosh(x) = " << result << " radian" << endl;
// result in degrees
cout << "acosh(x) = " << result*180/PI << " degree" << endl;
return 0;
}
运行该程序时,输出为:
acosh(x) = 3.27269 radian
acosh(x) = 187.511 degree
#include
#include
#define PI 3.141592654
using namespace std;
int main()
{
int x = 4;
double result;
result = acosh(x);
cout << "acosh(x) = " << result << " radian" << endl;
// result in degrees
cout << "acosh(x) = " << result*180/PI << " degree" << endl;
return 0;
}
运行该程序时,输出为:
acosh(x) = 2.06344 radian
acosh(x) = 118.226 degree