PHP.tanh(函数)

这个 tanh() 函数是PHP中的一个内置函数,用于查找作为参数传递给它的角度的双曲正切。 任何参数的双曲正切 阿格 定义为,

null

sinh(arg)/cosh(arg)

哪里 sinh() 是双曲正弦函数和 cosh() 是双曲余弦函数。

语法:

float tanh($value)

参数: 此函数接受单个参数$value。它是要查找其双曲正切值的数字。此参数的值必须以弧度为单位。

返回值: 它返回一个浮点数,它是作为参数传递给它的数字的双曲正切值。

例如:

Input : tanh(0.50)  
Output : 0.46211715726001

Input : tanh(-0.50) 
Output : -0.46211715726001

Input : tanh(5)
Output : 0.9999092042626

Input : tanh(M_PI_4) 
Output : 0.65579420263267

下面的程序使用不同的$value值来说明PHP中的tanh()函数:

  • 将0.50作为参数传递:

    <?php
    echo (tanh(0.50));
    ?>

    
    

    输出:

    0.46211715726001
  • 将-0.50作为参数传递:

    <?php
    echo (tanh(-0.50));
    ?>

    
    

    输出:

    -0.46211715726001
  • 将5作为参数传递:

    <?php
    echo (tanh(5));
    ?>

    
    

    输出:

    0.9999092042626
  • 当(M_PI_4)作为参数传递时,M_PI在PHP中是一个常数,其值为0.7853981633974830962:

    <?php
    echo (tanh(M_PI_4));
    ?>

    
    

    输出:

    0.65579420263267

参考 : http://php.net/manual/en/function.tanh.php

© 版权声明
THE END
喜欢就支持一下吧
点赞15 分享