Home >>Java Math Methods >Java Math.cosh() method

Java Math.cosh() method

Java Math.cosh() method

The java.lang. Math.cosh() is used to return a value of the hyperbolic cosine. You may define the hyperbolic cosine of any value x as (ex + e -x)/2, where e is the number of an Euler.

Syntax

public static double cosh(double x) 

Parameters

x = This parameter is used to the number whose hyperbolic cosine is to be returned.

Returns

It is used to returns the hyperbolic cosine of x.

  1. This method returns hyperbolic cosine value if the statement is positive or negative number.
  2. If Zero is the statement this method returns 1.0.
  3. If Infinity is the argument, then this approach returns Positive Infinity.
  4. This method returns -1 if the statement is -1.

Java Math.cosh() Method Example 1


public class MyClass
{
    public static void main(String[] args) 
    {
        double x = 20.0;
        System.out.println(Math.cosh(x));
    }
}

Output:
2.4258259770489514E8

Java Math.cosh() Method Example 2


public class MyClass  
{  
    public static void main(String[] args)   
    {                                                                         
        double x = 1.0;  
        System.out.println(Math.cosh(x));                                     
    }  
}  

Output:
1.543080634815244

No Sidebar ads