StrictMath sinh() Method in Java

The java.lang.StrictMath.sinh() method is used to return the hyperbolic sine of a double value passed as parameter to the function. The hyperbolic sine of x is defined by the formula $(e^x-e^-x)/2$ where e denotes Euler’s number

Syntax:

public static double sinh(double x)

Parameters:The function accepts a single double value x whose hyperbolic sine is to be returned by the function.



Return Values: This method returns a double value which is the hyperbolic sine of x. The following cases are arises:

  • The function returns NaN if the argument is NaN or infinity
  • The function returns infinity with the same sign as the argument if the argument is infinite.
  • The function returns zero with the same sign as the argument if the argument is zero

Examples:

Input : 0.7853981633974483
Output : 0.8686709614860095

Input : 4.0
Output : 27.28991719712775

Below programs illustrate the use of java.lang.StrictMath.sinh() method:

Program 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java Program to illustrate
// StrictMath.sinh() function 
  
import java.io.*;
import java.math.*;
import java.lang.*;
  
class GFG {
    public static void main(String[] args)
    {
  
        double x = (45 * Math.PI) / 180;
  
        // Display the hyperbolic sine of the value
        System.out.println("Hyperbolic sine of "
                 + x + " = " + StrictMath.sinh(x));
    }
}

chevron_right


Output:

Hyperbolic sine of 0.7853981633974483 = 0.8686709614860095

Program 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Java Program to illustrate
// StrictMath.sinh() function 
  
import java.io.*;
import java.math.*;
import java.lang.*;
  
class GFG {
    public static void main(String[] args)
    {
  
        double x1 = 180 / (0.0), x2 = 0;
  
        // Display the hyperbolic sine of the values
        System.out.println("Hyperbolic sine of "
                + x1 + " = " + StrictMath.sinh(x1));
        System.out.println("Hyperbolic sine of "
                + x2 + " = " + StrictMath.sinh(x2));
    }
}

chevron_right


Output:

Hyperbolic sine of Infinity = Infinity
Hyperbolic sine of 0.0 = 0.0

Reference: https://docs.oracle.com/javase/8/docs/api/java/lang/StrictMath.html#sinh()



My Personal Notes arrow_drop_up


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.