ruby-changes:28956
From: mrkn <ko1@a...>
Date: Sat, 1 Jun 2013 01:59:24 +0900 (JST)
Subject: [ruby-changes:28956] mrkn:r41008 (trunk): * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big
mrkn 2013-06-01 01:59:09 +0900 (Sat, 01 Jun 2013) New Revision: 41008 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41008 Log: * ext/bigdecimal/bigdecimal.c (BigDecimal_power): use rb_dbl2big to convert a double value to a Bignum. Modified files: trunk/ChangeLog trunk/ext/bigdecimal/bigdecimal.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41007) +++ ChangeLog (revision 41008) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sat Jun 01 01:50:00 2013 Kenta Murata <mrkn@m...> + + * 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@f...> * bignum.c (calc_hbase): Make hbase the maximum power of base Index: ext/bigdecimal/bigdecimal.c =================================================================== --- ext/bigdecimal/bigdecimal.c (revision 41007) +++ ext/bigdecimal/bigdecimal.c (revision 41008) @@ -2183,7 +2183,12 @@ retry: https://github.com/ruby/ruby/blob/trunk/ext/bigdecimal/bigdecimal.c#L2183 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/