summaryrefslogtreecommitdiff
path: root/bignum.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-07 07:16:12 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-07 07:16:12 +0000
commit7da40cbcb8861029d2bd5e5b3454b29a86631a01 (patch)
tree825f3c31366b27d8aa0adc6b7ca1b3dea15444e0 /bignum.c
parent840f8bcb9e9571fc44c02d8deb925c2e7ce76d0f (diff)
* 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
Diffstat (limited to 'bignum.c')
-rw-r--r--bignum.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bignum.c b/bignum.c
index 4db4bdb..0fa2233 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);