PHP | tanh( ) Function
The tanh() function is a builtin function in PHP and is used to find the hyperbolic tangent of an angle passed to it as parameter.
The hyperbolic tangent of any argument arg is defined as,
sinh(arg) / cosh(arg)
Where, sinh() is the hyperbolic sine function and cosh() is the hyperbolic cosine function.
Syntax:
float tanh($value)
Parameters: This function accepts a single parameter $value. It is the number whose hyperbolic tangent value you want to find. The value of this parameter must be in radians.
Return Value: It returns a floating point number which is the hyperbolic tangent value of a number passed to it as argument.
Examples:
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
Below programs, taking different values of $value are used to illustrate the tanh() function in PHP:
- Passing 0.50 as a parameter:
<?phpecho(tanh(0.50));?>chevron_rightfilter_noneOutput:
0.46211715726001
- Passing -0.50 as a parameter:
<?phpecho(tanh(-0.50));?>chevron_rightfilter_noneOutput:
-0.46211715726001
- Passing 5 as a parameter:
<?phpecho(tanh(5));?>chevron_rightfilter_noneOutput:
0.9999092042626
- When (M_PI_4) is passed as a parameter, M_PI is a constant in PHP whose value is 0.78539816339744830962 :
<?phpecho(tanh(M_PI_4));?>chevron_rightfilter_noneOutput:
0.65579420263267
Reference:
http://php.net/manual/en/function.tanh.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- PHP | end() Function
- PHP | Ds\Set xor() Function
- D3.js | d3.max() function
- PHP | pow( ) Function
- PHP | Ds\Map xor() Function
- PHP | each() Function
- PHP | Ds\Map put() Function
- D3.js | d3.map.set() Function
- PHP | max( ) Function
- CSS | rgb() Function
- p5.js | nf() Function
- PHP | min( ) Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



