Ruby | Math asin() function
The asin() is an inbuilt function in Ruby returns the arc sine of a number means give a sin value to this function it will return the angle in radian corresponding to that value. The value passed is in between -1 and +1.
Syntax: Math.sin(value)
Parameters: The function accepts one mandatory parameter value whose corresponding angle we have to find.
Return Value: It returns the angle in radians which in range -pi/2 to +pi/2.
Example 1:
#Ruby program for asin() function #Assigning values val1 = 1 val2 = 0.5 val3 = -1 val4 = -0.9 #Prints the asin() value puts Math.asin(val1) puts Math.asin(val2) puts Math.asin(val3) puts Math.asin(val4) |
Output:
1.5707963267948966 0.5235987755982989 -1.5707963267948966 -1.1197695149986342
Example 2:
#Ruby program for asin() function #Assigning values val1 = 0.87 val2 = 0.67 val3 = -0.679 val4 = -0.564 #Prints the asin() value puts Math.asin(val1) puts Math.asin(val2) puts Math.asin(val3) puts Math.asin(val4) |
Output:
1.0552023205488061 0.7342087874533589 -0.746399633896421 -0.59922176813665
Reference: https://devdocs.io/ruby~2.5/math#method-c-asin
Recommended Posts:
- Ruby | Math erf() function
- Ruby | Math cos() function
- Ruby | Math sin() function
- Ruby | Math tan() function
- Ruby | Math exp() function
- Ruby | Math log() function
- Ruby | CMath asin() Method
- Ruby | Math lgamma() function
- Ruby | Math cosh() function
- Ruby | Math log10() function
- Ruby | Math log2() function
- Ruby | Math tanh() function
- Ruby | Math hypot() function
- Ruby | Math acos() function
- Ruby | Math acosh() function
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.



