C++ Math tanh()
 
 
 C++ Math tanh()
 
 该函数计算以弧度表示的角度的双曲正切。
 
  Math 上 
 
 
语法
 
 假设角度为" x": 
 
 
 
  float tanh(float x);
double tanh(double x);
long double tanh(long double x);
double tanh(integral x);
 
   
  
参数
 
  x : 要计算其双曲正切值的值。
 
返回值
 
 它返回x的双曲正切。
 
示例1 
 
 让我们看一下x的值为整数类型的简单示例。 
 
 
 
  #include <iostream>
#include<math.h>
using namespace std;
 int main()
{
    int degree =60;
    float x = degree*3.14/180;
    std::cout << "Value of degree is : " <<degree<< std::endl;
    cout<<"tanh(x) : "<<tanh(x);
    return 0;
} 
   
  
  输出: 
 
 
 
  Value of degree is : 60
tanh(x) : 0.780507   
 
   
  
 在此示例中,tanh(x)函数计算x的双曲正切并返回值0.78、
 
示例2 
 
 让我们看一下简单x的值为浮点型时的示例。
 
 
 
  #include <iostream>
#include<math.h>
using namespace std;
int main()
{
    float degree = 45.2;
    float x = degree*3.14/180;
    std::cout << "Value of degree is : " <<degree<< std::endl;
    cout<<"tanh(x) : "<<tanh(x);
    return 0;
} 
   
  
  输出: 
 
 
 
  Value of degree is : 45.2
tanh(x) : 0.657552   
 
   
  
 在此示例中,tanh(x)函数计算x的双曲正切值并返回值0.65、