Related Articles

Related Articles

Ruby | Math sinh() function
  • Last Updated : 07 Jan, 2020

The sinh() is an inbuilt function in Ruby returns the hyperbolic sine of value given in radians. The value passed is in range [-inf, +inf]. The returned value is in range [-inf, +inf].

Syntax: Math.sinh(value)

Parameters: The function accepts one mandatory parameter value whose corresponding hyperbolic sine value is returned.

Return Value: It returns the hyperbolic sine value.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for sinh() function
  
#Assigning values
val1 = 0 val2 = 0.67 val3 = 1 val4 = 2
  
#Prints the sinh() value
                                     puts Math.sinh(val1)
                                         puts Math.sinh(val2)
                                             puts Math.sinh(val3)
                                                 puts Math.sinh(val4)

chevron_right


Output:

0.0
0.7212643714246986
1.1752011936438014
3.626860407847019

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for sinh() function
  
#Assigning values
val1 = 131 val2 = -0.9 val3 = -98 val4 = -767
  
#Prints the sinh() value
                                          puts Math.sinh(val1)
                                              puts Math.sinh(val2)
                                                  puts Math.sinh(val3)
                                                      puts Math.sinh(val4)

chevron_right


Output:

3.9043355367595756e+56
-1.0265167257081753
-1.8189854738044024e+42
-Infinity

Reference: https://devdocs.io/ruby~2.5/math#method-c-sinh




My Personal Notes arrow_drop_up
Recommended Articles
Page :