Ruby | BigDecimal atan() function
Last Updated :
06 Dec, 2019
BigDecimal#atan() : atan() is a BigDecimal class method which returns the value of arctangent to the specified number of digits of precision, numeric.
Syntax: BigDecimal.atan()
Parameter: BigDecimal values
Return: the value of arctangent to the specified number of digits of precision, numeric.
Example #1 :
require 'bigdecimal'
require 'bigdecimal/util'
require "bigdecimal/math"
include BigMath
a = BigMath.atan(BigDecimal( "10" ), 2 ).to_s
b = BigMath.atan(BigDecimal( "0" ), 1 ).to_s
c = BigMath.atan(BigDecimal( "-1" ), 3 ).to_s
puts "BigDecimal a atan method : #{a}\n\n"
puts "BigDecimal b atan method : #{b}\n\n"
puts "BigDecimal c atan method : #{c}\n\n"
|
Output :
BigDecimal a atan method : 0.147112767430373459205483371550142166365E1
BigDecimal b atan method : 0.0
BigDecimal c atan method : -0.7853981633974483096143979839729791083E0
Example #2 :
require 'bigdecimal'
require 'bigdecimal/util'
require "bigdecimal/math"
include BigMath
a = BigMath.atan(BigDecimal( "120" ), 2 ).to_s
b = BigMath.atan(BigDecimal( "1.0" ), 4 ).to_s
c = BigMath.atan(BigDecimal( "-3" ), 1 ).to_s
puts "BigDecimal a atan method : #{a}\n\n"
puts "BigDecimal b atan method : #{b}\n\n"
puts "BigDecimal c atan method : #{c}\n\n"
|
Output :
BigDecimal a atan method : 0.1562496517382685592451329995317025796273E1
BigDecimal b atan method : 0.7853981633974483096148978589729791083E0
BigDecimal c atan method : -0.127933953231702952636675255085153E1
Share your thoughts in the comments
Please Login to comment...