summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-23 10:52:40 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-23 10:52:40 +0000
commitb8bbc1a310b972a9622a2877ab8e0a1ef1fa8e95 (patch)
tree712ecd103377d231c308b198a4322e2e2078ef2d /ext/bigdecimal/lib
parentb09f41587c3b0f713890a9a1fdada63350657d1a (diff)
* ext/bigdecimal/lib/bigdecimal/math.rb (BigMath.E): Use BigMath.exp.
[Feature #6857] [ruby-core:47130] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb15
1 files changed, 1 insertions, 14 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rb
index 4504ccb..907d3b3 100644
--- a/ext/bigdecimal/lib/bigdecimal/math.rb
+++ b/ext/bigdecimal/lib/bigdecimal/math.rb
@@ -226,19 +226,6 @@ module BigMath
#
def E(prec)
raise ArgumentError, "Zero or negative precision for E" if prec <= 0
- n = prec + BigDecimal.double_fig
- one = BigDecimal("1")
- y = one
- d = y
- z = one
- i = 0
- while d.nonzero? && ((m = n - (y.exponent - d.exponent).abs) > 0)
- m = BigDecimal.double_fig if m < BigDecimal.double_fig
- i += 1
- z *= i
- d = one.div(z,m)
- y += d
- end
- y
+ BigMath.exp(1, prec)
end
end