# StrictMath cosh() Method in Java

The java.lang.StrictMath.cosh() is an inbuilt method in Java which returns the hyperbolic cosine value of a given double argument.

• The method returns NaN when the argument is NaN.
• The method returns a positive infinity when the argument is infinity.
• The method returns 1.0 when the given argument is 0.0.

Syntax :

`public static double cosh(double num)`

Parameters: The method accepts one parameter num of double type whose hyperbolic cosine value is to be returned.

Return Value : The method returns the hyperbolic cosine value of num.

Examples :

```Input: num = 60.0
Output: 5.710036949078421E25

Input: num = 0.0
Output: 1.0
```

Below programs illustrate the java.lang.StrictMath.cosh() method:
Program 1:

 `// Java praogram to illustrate the ` `// java.lang.StrictMath.cosh() ` `import` `java.lang.*; ` ` `  `public` `class` `Geeks { ` ` `  `    ``public` `static` `void` `main(String[] args) ` `    ``{ ` ` `  `        ``double` `num1 = ``78.8``, num2 = ``0.0``, num3 = ``1.0``; ` ` `  `        ``// It returns the hyperbolic cosine of ` `        ``// specified angle in radian ` `        ``double` `coshvalue = StrictMath.cosh(num1); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num1+``" = "` `+ coshvalue); ` ` `  `        ``coshvalue = StrictMath.cosh(num2); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num2+``" = "` `+ coshvalue); ` ` `  `        ``coshvalue = StrictMath.cosh(num3); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num3+``" = "` `+ coshvalue); ` `    ``} ` `} `

Output:

```The cosh of 78.8 = 8.344016962852523E33
The cosh of 0.0 = 1.0
The cosh of 1.0 = 1.543080634815244
```

Program 2:

 `// Java praogram to illustrate the ` `// java.lang.StrictMath.cosh() ` `import` `java.lang.*; ` ` `  `public` `class` `Geeks { ` ` `  `    ``public` `static` `void` `main(String[] args) ` `    ``{ ` ` `  `        ``double` `num1 = (``30` `* (Math.PI)) / ``180``; ` `        ``double` `num2 = ``11.0``, num3 = ``45.0``; ` ` `  `        ``// It returns the hyperbolic cosine of  ` `        ``// angle in radian ` `        ``double` `coshvalue = StrictMath.cosh(num1); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num1+``" = "` `+ coshvalue); ` ` `  `        ``coshvalue = StrictMath.cosh(num2); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num2+``" = "` `+ coshvalue); ` ` `  `        ``coshvalue = StrictMath.cosh(num3); ` `        ``System.out.println(``"The cosh of "``+ ` `                     ``num3+``" = "` `+ coshvalue);     ` `    ``} ` `} `

Output:

```The cosh of 0.5235987755982988 = 1.1402383210764286
The cosh of 11.0 = 29937.070865949758
The cosh of 45.0 = 1.7467135528742547E19
```

My Personal Notes arrow_drop_up

lets make it a lil simple

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.

Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.