diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-04 20:10:45 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-09-04 20:10:45 +0000 |
commit | 5f61a22950233184db0771ef743706f7c3f99371 (patch) | |
tree | 28ee455885b04363000385b59d057013ee7e8d76 /bignum.c | |
parent | bedda2d27f84ae4b28eed87671abc000e8a0eaf0 (diff) |
* numeric.c (fix_plus): addition in Fixnum will never overflow
long. a patch from Ondrej Bilka <neleai at seznam.cz>.
[ruby-core:08794]
* numeric.c (fix_minus): ditto.
* bignum.c (rb_big_pow): eagerly truncate resulting bignum.
[ruby-core:08794]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bignum.c')
-rw-r--r-- | bignum.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -1553,8 +1553,10 @@ rb_big_pow(VALUE x, VALUE y) while (yy % 2 == 0) { yy /= 2; x = rb_big_mul0(x, x); + if (!BDIGITS(x)[RBIGNUM(x)->len-1]) RBIGNUM(x)->len--; } z = rb_big_mul0(z, x); + if (!BDIGITS(z)[RBIGNUM(z)->len-1]) RBIGNUM(z)->len--; } return bignorm(z); } |