1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big

to convert a double value to a Bignum.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mrkn 2013-05-31 16:59:09 +00:00
parent e337c7f979
commit 1db209763a
2 changed files with 11 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Sat Jun 01 01:50:00 2013 Kenta Murata <mrkn@mrkn.jp>
* ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
to convert a double value to a Bignum.
Sat Jun 1 00:19:50 2013 Tanaka Akira <akr@fsij.org>
* bignum.c (calc_hbase): Make hbase the maximum power of base

View file

@ -2183,7 +2183,12 @@ retry:
case T_FLOAT:
d = RFLOAT_VALUE(vexp);
if (d == round(d)) {
vexp = LL2NUM((LONG_LONG)round(d));
if (FIXABLE(d)) {
vexp = LONG2FIX((long)d);
}
else {
vexp = rb_dbl2big(d);
}
goto retry;
}
exp = GetVpValueWithPrec(vexp, DBL_DIG+1, 1);