Java Math tanh() Method
Example
Return the hyperbolic tangent of different numbers:
System.out.println(Math.tanh(3));
System.out.println(Math.tanh(-3));
System.out.println(Math.tanh(0));
System.out.println(Math.tanh(1));
Definition and Usage
The tanh() method returns the hyperbolic tangent of a number.
The hyperbolic tangent is equivalent to Math.sinh(number) / Math.cosh(number).
Syntax
public static double tanh(double number)
Parameter Values
| Parameter | Description |
|---|---|
| number | Required. A number to find the hyperbolic tangent of. |
Technical Details
| Returns: | A double value representing the hyperbolic tangent of a number. |
|---|---|
| Java version: | 1.5+ |
❮ Math Methods