📅  最后修改于: 2020-09-25 07:25:01             🧑  作者: Mango
atanh() 函数采用单个参数,并以弧度返回该值的反双曲正切值。
该函数在
[Mathematics] tanh-1 x = atanh(x) [In C++ Programming]
double atanh(double x);
float atanh(float x);
long double atanh(long double x);
double atanh(T x); // For integral type
atanh() 函数采用单个强制性参数,范围为[-1,1]。
如果该值大于1或小于-1,则发生域错误。
atanh() 函数返回传递给它的参数的反双曲正切值。
Parameter (x) | Return Value |
---|---|
-1 < x < 1 | Finite value |
x = -1 | -∞ |
x = 1 | ∞ |
x < -1 or x > 1 | NaN (Not a Number |
#include
#include
#define PI 3.141592654
using namespace std;
int main()
{
double x = 0.32, result;
result = atanh(x);
cout << "atanh(x) = " << result << " radian" << endl;
// result in degrees
cout << "atanh(x) = " << result*180/PI << " degree" << endl;
return 0;
}
运行该程序时,输出为:
atanh(x) = 0.331647 radian
atanh(x) = 19.002 degree
#include
#include
#define PI 3.141592654
using namespace std;
int main()
{
int x = 1;
double result;
result = atanh(x);
cout << "atanh(x) = " << result << " radian" << endl;
// result in degrees
cout << "atanh(x) = " << result*180/PI << " degree" << endl;
return 0;
}
运行该程序时,输出为:
atanh(x) = inf radian
atanh(x) = inf degree