diff --git a/ChangeLog b/ChangeLog index 453226880b..e5dbce7525 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu May 1 23:20:12 2008 Nobuyoshi Nakada + + * bignum.c (rb_big_divide): return an integer for idiv. + [ruby-dev:34553] + Thu May 1 20:47:30 2008 Yukihiro Matsumoto * hash.c (rb_hash_s_create): should access converted hash value. diff --git a/bignum.c b/bignum.c index 8d95877e17..f38e0774ee 100644 --- a/bignum.c +++ b/bignum.c @@ -1815,7 +1815,15 @@ rb_big_divide(VALUE x, VALUE y, ID op) break; case T_FLOAT: - return DOUBLE2NUM(rb_big2dbl(x) / RFLOAT_VALUE(y)); + { + double div = rb_big2dbl(x) / RFLOAT_VALUE(y); + if (op == '/') { + return DOUBLE2NUM(div); + } + else { + return LONG2NUM((long)div); + } + } default: return rb_num_coerce_bin(x, y, op);