C tanh() 声明
double tanh( double arg );
tanh() 函数接受一个参数,并以 double
类型返回该值。
它定义在 <math.h> 头文件中。
[Mathematics] tanhx = tanh(x) [In C programming]
为了找到 long double 或 float 的 tanh(),您可以使用以下声明。
long double tanhl( long double arg); float tanhf( float arg);
C tanh() 范围
传递给 tanh() 函数的参数可以是任何数字,无论是负数还是正数。
示例:C tanh() 函数
#include <stdio.h>
#include <math.h>
#define PI 3.141592654
int main()
{
double angle = 0.40, result;
result = tanh(angle);
printf("Tangent hyperbolic of %.2lf (in radians) = %.2lf", angle, result);
return 0;
}
输出
Tangent hyperbolic of 0.40 (in radians) = 0.38