diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 9 |
2 files changed, 8 insertions, 7 deletions
@@ -1,3 +1,9 @@ +Fri Apr 16 21:27:57 2010 Yusuke Endoh <mame@tsg.ne.jp> + + * ext/bigdecimal/bigdecimal.c (BigDecimal_coerce): revert r23389, + which not only is unnecessary but also causes the inconsistency of + return type. [ruby-core:25706] [Bug #2129] + Fri Apr 16 20:05:24 2010 Yusuke Endoh <mame@tsg.ne.jp> * lib/thread.rb (Queue#push, #pop, SizedQueue#push, #pop): remove diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index 9930e63944..2dd3213dca 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -602,14 +602,9 @@ BigDecimal_coerce(VALUE self, VALUE other) ENTER(2); VALUE obj; Real *b; - switch (TYPE(other)) { - case T_FLOAT: + if (TYPE(other) == T_FLOAT) { obj = rb_assoc_new(other, BigDecimal_to_f(self)); - break; - case T_RATIONAL: - obj = rb_assoc_new(other, BigDecimal_to_r(self)); - break; - default: + } else { GUARD_OBJ(b,GetVpValue(other,1)); obj = rb_assoc_new(b->obj, self); } |