Java Data Type Tutorial - Java StrictMath.tanh(double x)








Syntax

StrictMath.tanh(double x) has the following syntax.

public static double tanh(double x)

Example

In the following code shows how to use StrictMath.tanh(double x) method.

// w  w  w .  j  a v  a 2 s .c  o m

public class Main {

  public static void main(String[] args) {
  
    double d1 = (90*Math.PI)/180 , d2 = 0.0;
    double d3 = (1.0)/(0.0), d4 = -(1.0)/(0.0);

    System.out.println("hyperbolic tangent of d1 = " + StrictMath.tanh(d1));
        
    System.out.println("hyperbolic tangent of d2 = " + StrictMath.tanh(d2));
        
    System.out.println("hyperbolic tangent of d3 = " + StrictMath.tanh(d3));
        
    System.out.println("hyperbolic tangent of d4 = " + StrictMath.tanh(d4));
  }
}

The code above generates the following result.