Share
The sinh()
function returns the hyperbolic sine of a number. To be more specific, it returns the hyperbolic sine of a number in radians
.
The figure below shows the mathematical representation of the sinh()
function.
The
scala.math._
header file is required for this function.
Double sinh(Double number)
This function requires a number
that represents an angle
in radians
as a parameter.
You can use the following formula to convert
degrees
toradians
.
radians = degrees * ( Pi / 180 )
sinh()
returns the
- If the parameter value is
PositiveInfinity
, then it returns positive infinity.- If the parameter value is
NegativeInfinity
, then it returns negative infinity.- If the parameter value is
NaN
, then it returnsNaN
.
import scala.math._object Main extends App {//positive number in radiansprintln(s"The value of sinh(2.3) = ${sinh(2.3)}");// negative number in radiansprintln(s"The value of sinh(-2.3) = ${sinh(-2.3)}");//converting the degrees angle into radians and then applying sinh()// degrees = 45.0// PI = 3.14159265// result first converts degrees to radians then apply sinhprintln(s"The value of sinh(45.0) = ${sinh(45.0 * (Pi / 180.0))}");//error outputsprintln(s"The value of sinh(Double.PositiveInfinity) = ${sinh(Double.PositiveInfinity)}");println(s"The value of sinh(Double.NegativeInfinity) = ${sinh(Double.NegativeInfinity)}");println(s"The value of sinh(Double.NaN) = ${sinh(Double.NaN)}");}