66
Java Math.tanh() method
The java.lang.Math.tanh() is used to return the hyperbolic tangent of a value. The hyperbolic tangent of any value x can be defined as ((ex – e -x)/2) / ((ex + e -x)/2), where e is an Euler’s number. We can say that tanh(a) = sinh(a)/cosh(a).
Syntax
Parameter
Return
- If the argument is positive or negative number, this method will return hyperbolic tangent value.
- If the argument is Zero, this method will return zero with the same sign as the argument.
- If the argument is NaN, this method will return NaN.
- If the argument is Positive Infinity, this method will return +1.0.
- If the argument is Negative Infinity, this method will return -1.0.
Example 1
Output:
0.9999999999244973
Example 2
Output:
1.0
Example 3
Output:
-0.0
Example 4
Output:
NaN
Example 5
Output:
-1.0
Next TopicJava Math