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); } } |
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); } } |
The cosh of 0.5235987755982988 = 1.1402383210764286 The cosh of 11.0 = 29937.070865949758 The cosh of 45.0 = 1.7467135528742547E19
Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.
Recommended Posts:
- Java Math cosh() method with Examples
- Java.lang.StrictMath class in Java | Set 1
- Java.lang.StrictMath class in Java | Set 2
- StrictMath log1p() Method in Java
- StrictMath IEEEremainder() Method in Java
- StrictMath nextAfter() Method in Java
- StrictMath tan() Method in Java
- StrictMath atan2() Method in Java
- StrictMath hypot() Method in Java
- StrictMath acos() Method in Java
- StrictMath asin() Method in Java With Examples
- StrictMath atan() Method in Java
- StrictMath cbrt() Method in Java
- StrictMath ceil() Method in Java with Examples
- StrictMath cos() Method in Java with Examples
- StrictMath exp() Method in Java
- StrictMath expm1() Method in Java With Examples
- StrictMath floor() Method in Java
- StrictMath getExponent() Method In Java
- StrictMath log() Method In Java
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.

