English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C++ atanh() 函数使用方法及示例

C++ Fonction de bibliothèque <cmath>

C ++中的atanh()函数返回弧度数的反双曲正切(反双曲正切)。

atanh()函数采用单个参数,并以弧度返回该值的反双曲正切值。

该函数在<cmath>头文件中定义。

tanh-1 x = atanh(x)

atanh()原型[从C ++ 11标准开始]

double atanh(double x);
float atanh(float x);
long double atanh(long double x);
double atanh(T x); // 为整型

atanh()参数

atanh()函数采用单个强制性参数,范围为[-1,1]。

如果该值大于1或小于-1,则发生域错误。

atanh()返回值

atanh()函数返回传递给它的参数的反双曲正切值。

atanh()返回值表
参数(x)返回值
-1 <x <1有限值
x = -1-∞
x = 1
x <-1或x> 1NaN(非数字)

Exemple1:atanh()函数在C ++中如何工作?

#include <iostream>
#include <cmath>
#define PI 3.141592654
using namespace std;
int main()
{
	double x = 0.32, result;
	result = atanh(x);
	cout << "atanh(x) = " << result << " rayon" << endl;
	cout << "atanh(x) = " << result*180/PI << " " << endl;
	return 0;
}

Lors de l'exécution de ce programme, la sortie est :

atanh(x) = 0.331647 radian
atanh(x) = 19.002 degree

Exemple2:具有整数类型的atanh()函数

#include <iostream>
#include <cmath>
#define PI 3.141592654
using namespace std;
int main()
{
	int x =; 1;
	double result;
	result = atanh(x);
	cout << "atanh(x) = " << result << " rayon" << endl;
	cout << "atanh(x) = " << result*180/PI << " " << endl;
	return 0;
}

Lors de l'exécution de ce programme, la sortie est :

atanh(x) = inf rayon
atanh(x) = inf degré

C++ Fonction de bibliothèque <cmath>