summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/bigdecimal/bigdecimal.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index f9fa1e7..866a4ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 06b3886..2a0aea8 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -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);