Open In App

Ruby | Math asinh() function

Last Updated : 04 Dec, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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.asinh(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:  

Ruby




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


Output

1.4436354751788103
7.4696544979749735
6.761574108393271
4.45448247706051

Example 2

Ruby




#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)


Output

-3.8716347563877314
-7.333023441572332
-5.278140689034662
-3.8291136516208812

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



Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads