Ruby | BigDecimal exp() function Last Updated : 26 Dec, 2022 Comments Improve Suggest changes Like Article Like Report BigDecimal#exp() : exp() is a BigDecimal class method which returns the value of e (the base of natural logarithms) raised to the power of decimal, to the specified number of digits of precision. Syntax: BigDecimal.exp() Parameter: BigDecimal values Return: the value of e (the base of natural logarithms) raised to the power of decimal Example #1 : Ruby # Ruby code for BigDecimal.exp() method # loading library require 'bigdecimal' # declaring bigdecimal a = BigDecimal("10") # declaring bigdecimal b = BigDecimal("1000") *2 # declaring bigdecimal c = BigDecimal("11.43") # exp() method puts "BigDecimal a exp method : #{Math.exp(a)}\n\n" puts "BigDecimal b exp method : #{Math.exp(b)}\n\n" puts "BigDecimal c exp method : #{Math.exp(c)}\n\n" Output : BigDecimal a exp method : 22026.465794806718 BigDecimal b exp method : Infinity BigDecimal c exp method : 92041.97481768382 Example #2 : Ruby # Ruby code for BigDecimal.exp() method # loading library require 'bigdecimal' # declaring bigdecimal a = BigDecimal('12')*12 # declaring bigdecimal b = BigDecimal('10')+(22 ** 7.1) ** 10 # declaring bigdecimal c = -BigDecimal('-3') # exp() method puts "BigDecimal a exp method : #{Math.exp(a)}\n\n" puts "BigDecimal b exp method : #{Math.exp(b)}\n\n" puts "BigDecimal c exp method : #{Math.exp(c)}\n\n" Output : BigDecimal a exp method : 3.454660656717546e+62 BigDecimal b exp method : Infinity BigDecimal c exp method : 20.085536923187668 Comment More infoAdvertise with us Next Article Ruby | BigDecimal E() function M mayank5326 Follow Improve Article Tags : Ruby Ruby-Methods Ruby BigDecimal-class Similar Reads Ruby | BigDecimal E() function BigDecimal#E() : E() is a BigDecimal class method which returns the value of arctangent to the specified number of digits of precision, numeric. Syntax: BigDecimal.E() Parameter: BigDecimal values Return: the value of arctangent to the specified number of digits of precision, numeric. Example #1 : R 2 min read Ruby | BigDecimal cos() function BigDecimal#cos() : cos() is a BigDecimal class method which returns the value of cosine to the specified number of digits of precision, numeric. Syntax: BigDecimal.cos() Parameter: BigDecimal values Return: the value of cosine to the specified number of digits of precision, numeric. Example #1 : Exa 2 min read Ruby | BigDecimal to_f() function BigDecimal#to_f() : to_f() is a BigDecimal class method which returns a new Float object having approximately the same value as the BigDecimal number. Syntax: BigDecimal.to_f() Parameter: BigDecimal values Return: a new Float object having approximately the same value as the BigDecimal number. Examp 2 min read Ruby | BigDecimal to_d() function BigDecimal#to_d() : to_d() is a BigDecimal class method which returns the self of Big decimal. Syntax: BigDecimal.to_d() Parameter: BigDecimal values Return: the self of Big decimal. Example #1 : Ruby # Ruby code for BigDecimal.to_d() method # loading library require 'bigdecimal' require 'bigdecimal 1 min read Ruby | BigDecimal PI() function BigDecimal#PI() : PI() is a BigDecimal class method which returns the value of pi to the specified number of digits of precision, numeric. Syntax: BigDecimal.PI() Parameter: BigDecimal values Return: the value of pi to the specified number of digits of precision, numeric. Example #1 : Ruby # Ruby co 2 min read Ruby | BigDecimal log() function BigDecimal#log() : log() is a BigDecimal class method which returns the natural logarithm of decimal to the specified number of digits of precision, numeric. Syntax: BigDecimal.log() Parameter: BigDecimal values Return: the natural logarithm of decimal to the specified number of digits of precision, 2 min read Like