該函數計算以弧度給定的角度的弧雙曲正切值。
其中,弧雙曲正切是雙曲正切的逆運算。
tanh-1x = atanh(x)
用法
假設以弧度給出的角度是 'x':
float atanh(float x);
double atanh(double x);
long double atanh(long double x);
double atanh(integral x);
注意:return_type 可以是 float,double long double。
參數
x:要計算其弧雙曲正切值的值。
返回值
它返回 x 的弧雙曲正切值。
參數 | 返回值 |
---|---|
-1有限的價值 |
|
x= -1 | -inf |
x=1 | inf |
x1 | 不是數字(nan) |
例子1
讓我們看一個簡單的例子,當 x 的值介於 -1 和 1 之間時。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
float x=0.5;
std::cout << "value of x is:" <<x <<std::endl;
cout<<"atanh(x):"<<atanh(x);
return 0;
}
輸出:
value of x is:0.5 atanh(x):0.549306
在此示例中,atanh(x) 函數計算 x 的弧雙曲正切並返回值 0.54。
例子2
讓我們看一個簡單的例子,當 x 的值為 -1 時。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int x= -1;
std::cout << "value of x is:" <<x <<std::endl;
cout<<"atanh(x):"<<atanh(x);
return 0;
}
輸出:
value of x is:-1 atanh(x):-inf
在本例中,atanh(x) 函數計算 x 的弧雙曲正切並返回值 ?inf。
例子3
讓我們看一個簡單的例子,當 x 的值等於 1 時。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int x=1;
std::cout << "value of x is:" <<x <<std::endl;
cout<<"atanh(x):"<<atanh(x);
return 0;
}
輸出:
value of x is:1 atanh(x):inf
在此示例中,atanh(x) 計算 x 的弧雙曲正切並返回值 inf。
示例 4
我們來看一個簡單的例子,當 x 的值大於 1 時。
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
int x=5;
std::cout << "value of x is:" <<x <<std::endl;
cout<<"atanh(x):"<<atanh(x);
return 0;
}
輸出:
value of x is:5 atanh(x):-nan
在此示例中,atanh(x) 計算 x 的弧雙曲正切並返回值 -nan。
相關用法
- C++ Math atan()用法及代碼示例
- C++ Math atan2()用法及代碼示例
- C++ Math acosh()用法及代碼示例
- C++ Math asinh()用法及代碼示例
- C++ Math asin()用法及代碼示例
- C++ Math abs()用法及代碼示例
- C++ Math acos()用法及代碼示例
- C++ Math scalbn()用法及代碼示例
- 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 atanh()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。