Ruby | CMath asin() Method

asin() method is CMath class which is used to returns the arc sine of the given value.

Syntax: Math.asin(z)

Parameter: Here, z is the value whose arc sine is to be calculated.



Returns: This method returns the arc sine value of the z.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for asin() method
require 'cmath'
  
# Initialize value 
a = 0.3584
b = 2
  
# Printing result  
puts "asin value of a : #{CMath.asin(a)}\n\n" 
puts "asin value of b : #{CMath.asin(b)}\n\n"

chevron_right


Output:

asin value of a : 0.3665534738291246

asin value of b : 1.5707963267948966-1.3169578969248166i

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

# Ruby code for asin() method
require 'cmath'
  
# Initialize value 
a = 0
b = -0.247
  
# Printing result  
puts "asin value of a : #{CMath.asin(a)}\n\n" 
puts "asin value of b : #{CMath.asin(b)}\n\n"

chevron_right


Output:

asin value of a : 0.0

asin value of b : -0.24958310188075922


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.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.