定义

tanh()函数返回一个数字的双曲正切,等于sinh(x)/cosh(x)。

 

语法

PHP tanh()函数具有以下语法。

tanh(number);

 

参数

参数 是否必须 描述
number 需要。 指定数字

 

返回值

返回 描述
返回值 双曲正切数
返回类型 浮点型

 

实例

返回不同数字的双曲正切:

<?php
/*
http://www.manongjc.com/article/1749.html
作者:码农教程
*/
echo(tanh(M_PI_4) . \"\\n\");
echo(tanh(0.5) . \"\\n\");
echo(tanh(-0.5) . \"\\n\");
echo(tanh(5) . \"\\n\");
echo(tanh(1) . \"\\n\");
echo(tanh(-1) . \"\\n\");
echo(tanh(-10));
?>

上面的代码生成以下结果:

0.65579420263267
0.46211715726001
-0.46211715726001
0.9999092042626
0.76159415595576
-0.76159415595576
-0.99999999587769
收藏 打印