1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* bignum.c (bigdivmod): wrong condition check for Bignum zero.

* bignum.c (Init_Bignum): need to add Bignum#div.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-10-07 07:16:12 +00:00
parent 840f8bcb9e
commit 7da40cbcb8
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Mon Oct 7 15:36:42 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* 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 <aamine@loveruby.net>
* eval.c (rb_load): should not pass blocks to the loaded file.

View file

@ -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);