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

bignum divmod bug

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2000-06-06 02:39:39 +00:00
parent ecd1aab526
commit 0dedfa849c

View file

@ -804,7 +804,10 @@ bigdivmod(x, y, div, mod, modulo)
RBIGNUM(z)->sign = RBIGNUM(x)->sign==RBIGNUM(y)->sign;
if (div) *div = bignorm(z);
if (mod) {
if (!RBIGNUM(y)->sign) t2 = -(long)t2;
if (!RBIGNUM(x)->sign) t2 = -(long)t2;
if (modulo && RBIGNUM(x)->sign != RBIGNUM(y)->sign) {
t2 = t2 + yds[0] * (RBIGNUM(y)->sign ? 1 : -1);
}
*mod = INT2NUM(t2);
}
return;