Ruby Tutorial Ruby References

Ruby - Math.sinh() Method



The Ruby Math.sinh() method returns hyperbolic sine of a value. The hyperbolic sine of x is defined as:

sinh

where e is an Euler's number.

Syntax

Math.sinh(x)

Parameters

x Specify the value.

Return Value

Returns the hyperbolic sine of a value.

Example:

In the example below, Math.sinh() method is used to find out the hyperbolic sine of a value.

puts "Math.sinh(-4) = #{Math.sinh(-4)}"
puts "Math.sinh(-2) = #{Math.sinh(-2)}"
puts "Math.sinh(0) = #{Math.sinh(0)}"
puts "Math.sinh(2) = #{Math.sinh(2)}"
puts "Math.sinh(4) = #{Math.sinh(4)}"

The output of the above code will be:

Math.sinh(-4) = -27.28991719712775
Math.sinh(-2) = -3.626860407847019
Math.sinh(0) = 0.0
Math.sinh(2) = 3.626860407847019
Math.sinh(4) = 27.28991719712775

❮ Ruby Math Module