summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--ext/bigdecimal/bigdecimal.c5
2 files changed, 5 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 025a181..a7507fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,10 @@
-Tue Feb 11 23:42:27 2014 Tanaka Akira <akr@fsij.org>
+Tue Feb 11 23:54:40 2014 Tanaka Akira <akr@fsij.org>
* bignum.c (rb_big_cmp): Specialize a comparison to zero.
* ext/bigdecimal/bigdecimal.c (is_negative): Use rb_big_cmp instead of
RBIGNUM_NEGATIVE_P.
+ (BigMath_s_log): Ditto.
Tue Feb 11 22:59:10 2014 Tanaka Akira <akr@fsij.org>
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index f426a45..ffc6613 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2874,8 +2874,9 @@ BigMath_s_log(VALUE klass, VALUE x, VALUE vprec)
goto get_vp_value;
case T_BIGNUM:
- zero = RBIGNUM_ZERO_P(x);
- negative = RBIGNUM_NEGATIVE_P(x);
+ i = FIX2INT(rb_big_cmp(x, INT2FIX(0)));
+ zero = i == 0;
+ negative = i < 0;
get_vp_value:
if (zero || negative) break;
vx = GetVpValue(x, 0);