We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 83e3b3d commit b2a76d2Copy full SHA for b2a76d2
lib/bigdecimal.rb
@@ -203,7 +203,7 @@ def self.log(x, prec)
203
if x > 10 || x < 0.1
204
log10 = log(BigDecimal(10), prec)
205
exponent = x.exponent
206
- x = x * BigDecimal("1e#{-x.exponent}")
+ x = x._decimal_shift(-exponent)
207
if x < 0.3
208
x *= 10
209
exponent -= 1
@@ -269,7 +269,7 @@ def self.exp(x, prec)
269
# exp(x * 10**cnt) = exp(x)**(10**cnt)
270
cnt = x > 1 ? x.exponent : 0
271
prec2 = prec + BigDecimal.double_fig + cnt
272
- x *= BigDecimal("1e-#{cnt}")
+ x = x._decimal_shift(-cnt)
273
xn = BigDecimal(1)
274
y = BigDecimal(1)
275
0 commit comments