C++官网参考链接:https://cplusplus.com/reference/cmath/tanh/
函数
<cmath>
tanh
C90
double tanh (double x);
C99
double tanh (double x);
float tanhf (float x);
long double tanhl (long double x);
C++
double tanh (double x);
float tanh (float x);
long double tanh (long double x);
double tanh (T x); // additional overloads for integral types
计算双曲正切
返回x的双曲正切。
C99
头文件
C++98
该函数在头文件
C++11
在此头文件(
此函数在
形参
x
表示双曲角度的值。
返回值
x的双曲正切。
用例
/* tanh example */
#include
#include
int main ()
{
double param, result;
param = log(2.0);
result = tanh (param);
printf ("The hyperbolic tangent of %f is %f.\n", param, result);
return 0;
}
输出: