📜  红宝石 | BigDecimal E()函数

📅  最后修改于: 2022-05-13 01:54:22.239000             🧑  作者: Mango

红宝石 | BigDecimal E()函数

BigDecimal#E() : E()是一个 BigDecimal 类方法,它将反正切的值返回到指定的精度位数,数字。

示例 #1:

# Ruby code for BigDecimal.E() method
  
# loading library
require 'bigdecimal'
require 'bigdecimal/util'
  
require "bigdecimal/math"
  
include BigMath
  
# declaring bigdecimal
a = BigMath.E(BigDecimal("10")).to_s
  
# declaring bigdecimal
b = BigMath.E(BigDecimal("032")).to_s
  
# declaring bigdecimal
c = BigMath.E(BigDecimal("1")).to_s
  
  
# E() method
puts "BigDecimal a E method : #{a}\n\n"
  
puts "BigDecimal b E method : #{b}\n\n"
  
puts "BigDecimal c E method : #{c}\n\n"

输出 :

BigDecimal a E method : 0.2718281828E1

BigDecimal b E method : 0.27182818284590452353602874713527E1

BigDecimal c E method : 0.3E1

示例 #2:

# Ruby code for BigDecimal.E() method
  
# loading library
require 'bigdecimal'
require 'bigdecimal/util'
  
require "bigdecimal/math"
  
include BigMath
  
# declaring bigdecimal
a = BigMath.E(BigDecimal("120")).to_s
  
# declaring bigdecimal
b = BigMath.E(BigDecimal("1.0")).to_s
  
# declaring bigdecimal
c = BigMath.E(BigDecimal("3")).to_s
  
# E() method
puts "BigDecimal a E method : #{a}\n\n"
  
puts "BigDecimal b E method : #{b}\n\n"
  
puts "BigDecimal c E method : #{c}\n\n"

输出 :

BigDecimal a E method : 0.271828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992E1

BigDecimal b E method : 0.3E1

BigDecimal c E method : 0.272E1