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 34f5524 commit a6a11e7Copy full SHA for a6a11e7
lib/bigdecimal.rb
@@ -174,7 +174,7 @@ def self.log(x, prec)
174
if x > 10 || x < 0.1
175
log10 = log(BigDecimal(10), prec)
176
exponent = x.exponent
177
- x = x * BigDecimal("1e#{-x.exponent}")
+ x = x._decimal_shift(-exponent)
178
if x > 3
179
x /= 10
180
exponent += 1
@@ -240,7 +240,7 @@ def self.exp(x, prec)
240
# exp(x * 10**cnt) = exp(x)**(10**cnt)
241
cnt = x > 1 ? x.exponent : 0
242
prec2 = prec + BigDecimal.double_fig + cnt
243
- x *= BigDecimal("1e-#{cnt}")
+ x = x._decimal_shift(-cnt)
244
xn = BigDecimal(1)
245
y = BigDecimal(1)
246
0 commit comments