summaryrefslogtreecommitdiffstats
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
commit142f88b450e04a2eeb483439ea9ab1d3ed8da96d (patch)
tree825f3c31366b27d8aa0adc6b7ca1b3dea15444e0 /bignum.c
parented699e6b86bee3c78079476016c57b262d75a883 (diff)
downloadruby-142f88b450e04a2eeb483439ea9ab1d3ed8da96d.tar.gz
ruby-142f88b450e04a2eeb483439ea9ab1d3ed8da96d.tar.xz
ruby-142f88b450e04a2eeb483439ea9ab1d3ed8da96d.zip
* bignum.c (bigdivmod): wrong condition check for Bignum zero.
* bignum.c (Init_Bignum): need to add Bignum#div. git-svn-id: http://svn.ruby-lang.org/repos/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 4db4bdb6a..0fa2233eb 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);