atanh(x)函数详解

首页 / C++入门教程 / atanh(x)函数详解

该函数计算以弧度表示的角度的双曲正切。

其中,双曲线正切是双曲正切的逆运算。

tanh-1x =atanh(x)

atanh - 语法

假设以弧度表示的角度为" x":

float atanh(float x);
double atanh(double x);
long double atanh(long double x);
double atanh(integral x);

Note: return_type可以是float,double long double。

atanh - 参数

x :要计算其双曲线正切值的值。

atanh - 返回值

它返回x的弧双曲正切值。

参数 返回值
-1 Finite value
x= -1 -inf
x=1 inf
x1 Not a Number(nan)

atanh - 例子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。

atanh - 例子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。

atanh - 例子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。

atanh - 例子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值。

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

零基础学Python -〔尹会生〕

RPC实战与核心原理 -〔何小锋〕

手机摄影 -〔@随你们去〕

乔新亮的CTO成长复盘 -〔乔新亮〕

容器实战高手课 -〔李程远〕

JavaScript进阶实战课 -〔石川〕

超级访谈:对话毕玄 -〔毕玄〕

高并发系统实战课 -〔徐长龙〕

工程师个人发展指南 -〔李云〕

好记忆不如烂笔头。留下您的足迹吧 :)