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