diff --git a/ChangeLog b/ChangeLog index d099b1fa88..cf5a0d5d47 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Mon Oct 7 15:36:42 2002 Yukihiro Matsumoto + + * bignum.c (bigdivmod): wrong condition check for Bignum zero. + + * bignum.c (Init_Bignum): need to add Bignum#div. + Sun Oct 6 00:49:15 2002 Minero Aoki * eval.c (rb_load): should not pass blocks to the loaded file. diff --git a/bignum.c b/bignum.c index 4db4bdb6a6..0fa2233ebc 100644 --- a/bignum.c +++ b/bignum.c @@ -1244,7 +1244,7 @@ bigdivmod(x, y, divp, modp) bigdivrem(x, y, divp, &mod); if (RBIGNUM(x)->sign != RBIGNUM(y)->sign && - RBIGNUM(mod)->len > 0 && BDIGITS(mod)[0] != 0) { + !(RBIGNUM(mod)->len == 1 && BDIGITS(mod)[0] == 0)) { if (divp) *divp = bigadd(*divp, rb_int2big(1), 0); if (modp) *modp = bigadd(mod, y, 1); } @@ -1730,6 +1730,7 @@ Init_Bignum() rb_define_method(rb_cBignum, "*", rb_big_mul, 1); rb_define_method(rb_cBignum, "/", rb_big_div, 1); rb_define_method(rb_cBignum, "%", rb_big_modulo, 1); + rb_define_method(rb_cBignum, "div", rb_big_div, 1); rb_define_method(rb_cBignum, "divmod", rb_big_divmod, 1); rb_define_method(rb_cBignum, "modulo", rb_big_modulo, 1); rb_define_method(rb_cBignum, "remainder", rb_big_remainder, 1);