PHP tanh()函数
PHP tanh() 函数是预定义的三角函数。它用于返回一个数的双曲正切值。它等于sinh(x)/cos(x)。
语法
float cosh ( float $arg );
Parameter | Description | Required/Optional |
---|---|---|
arg | Specify a argument | Required |
示例1
<?php
n=4;
echo "Your number is:".n;
echo "<br>"."By using 'tanh()' function your value is:".tanh($n)."<br>";
?>
输出:
Your number is:4
By using 'tanh()' function your value is:0.99932929973907
示例2
<?php
n=(-4);
echo "Your number is:".n;
echo "<br>"."By using 'tanh()' function your value is:".tanh($n)."<br>";
?>
输出:
Your number is:-4
By using 'tanh()' function your value is:-0.99932929973907
示例3
<?php
n=(0.50);
echo "Your number is:".n;
echo "<br>"."By using 'tanh()' function your value is:".tanh($n)."<br>";
?>
输出结果:
Your number is:0.5
By using 'tanh()' function your value is:0.46211715726001
示例4
<?php
n=(-0.50);
echo "Your number is:".n;
echo "<br>"."By using 'tanh()' function your value is:".tanh($n)."<br>";
?>
输出:
Your number is:-0.5
By using 'tanh()' function your value is:-0.46211715726001
示例5
<?php
n=(M_PI_4);
echo "Your number is: M_PI_4";
echo "<br>"."By using 'tanh()' function your value is:".tanh(n)."<br>";
?>
输出:
Your number is: M_PI_4
By using 'tanh()' function your value is:0.65579420263267