C语言 <math.h> tanh 函数 描述 C库函数double tanh(double x))返回的x的双曲正切。 声明 以下是tanh函数的声明。 double tanh(double x) 复制 参数 x - 这是浮点值。 返回值 此函数返回x的双曲正切值。 示例 以下示例显示tanh函数的用法- #include <stdio.h> #include <math.h> int main () { double x, ret; x = 0.5; ret = tanh(x); printf("The hyperbolic tangent of %lf is %lf degrees", x, ret); return(0); } 复制尝试一下 让我们编译并运行上面的程序,它将产生以下结果- The hyperbolic tangent of 0.500000 is 0.462117 degrees 复制 返回math.h头文件