Ruby | Math asinh() function

The asinh() is an inbuilt function in Ruby returns the inverse hyperbolic sine of an angle given in radians. It accepts all values between range (-INFINITY, INFINITY).

Syntax: Math.acosh(value)

Parameters: The function accepts one mandatory parameter value which specifies the inverse hyperbolic angle in radian which should be greater or equal to 1. If the argument is less than 1, domain error is returned.



Return Value: The function returns the inverse hyperbolic sine of an angle given in radians. The range is between (-INFINITY, INFINITY)

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for asinh() function
  
#Assigning values
val1 = 2 val2 = 877 val3 = 432 val4 = 43
  
#Prints the acosh() value
                                      puts Math.asinh(val1)
                                          puts Math.asinh(val2)
                                              puts Math.asinh(val3)
                                                  puts Math.asinh(val4)

chevron_right


Output:

1.4436354751788103
7.4696544979749735
6.761574108393271
4.45448247706051

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

#Ruby program for asinh() function
  
#Assigning values
val1 = -24 val2 = -765 val3 = -98 val4 = -23
  
#Prints the asinh() value
                                          puts Math.asinh(val1)
                                              puts Math.asinh(val2)
                                                  puts Math.asinh(val3)
                                                      puts Math.asinh(val4)

chevron_right


Output:

-3.8716347563877314
-7.333023441572332
-5.278140689034662
-3.8291136516208812

Reference: https://devdocs.io/ruby~2.5/math#method-i-asinh



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.