# Ruby code for atan() methodrequire'cmath'# Initializing value
a =0.3584
b =2# Printing result
puts "atan value of a : #{CMath.atan(a)}\n\n"
puts "atan value of b : #{CMath.atan(b)}\n\n"
Ruby
输出
atan value of a :0.34413842830780517
atan value of b :1.1071487177940904
Ruby
例2 :
# Ruby code for atan() methodrequire'cmath'# Initializing value
a =0
b =-0.247# Printing result
puts "atan value of a : #{CMath.atan(a)}\n\n"
puts "atan value of b : #{CMath.atan(b)}\n\n"
Ruby
输出
atan value of a :0.0
atan value of b :-0.24215314674687552