summaryrefslogtreecommitdiff log msg author committer range
diff options
 context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only
-rw-r--r--ChangeLog5
-rw-r--r--ext/bigdecimal/lib/bigdecimal/math.rb15
2 files changed, 6 insertions, 14 deletions
 diff --git a/ChangeLog b/ChangeLogindex 2323332883..cae760fb95 100644--- a/ChangeLog+++ b/ChangeLog@@ -1,3 +1,8 @@+Sat Nov 23 19:52:00 2013 Kenta Murata ++ * ext/bigdecimal/lib/bigdecimal/math.rb (BigMath.E): Use BigMath.exp.+ [Feature #6857] [ruby-core:47130]+ Sat Nov 23 19:46:00 2013 Kenta Murata * ext/bigdecimal/bigdecimal.c (BigMath_s_exp): Optimize thediff --git a/ext/bigdecimal/lib/bigdecimal/math.rb b/ext/bigdecimal/lib/bigdecimal/math.rbindex 4504ccb2b0..907d3b3829 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