Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Ruby | CMath asin() Method

  • Last Updated : 07 Jan, 2020

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:






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

Output:

asin value of a : 0.3665534738291246

asin value of b : 1.5707963267948966-1.3169578969248166i

Example 2:




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

Output:

asin value of a : 0.0

asin value of b : -0.24958310188075922
My Personal Notes arrow_drop_up
Recommended Articles
Page :