* numeric.c (int_pow): bugfix of overflow detection.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2007-04-27 08:05:21 +00:00
parent 5d2069cd56
commit ea2cb282ae
2 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,6 @@
Fri Apr 27 12:54:35 2007 Nobuyoshi Nakada <nobu@ruby-lang.org> Fri Apr 27 17:05:41 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (int_pow): bugfix of overflow detection.
* numeric.c (int_pow): rb_big_pow() may return other than Bignum. * numeric.c (int_pow): rb_big_pow() may return other than Bignum.

View File

@ -2283,7 +2283,7 @@ int_pow(long x, unsigned long y)
} }
{ {
long xz = x * z; long xz = x * z;
if (xz < z || xz < x || !POSFIXABLE(xz)) { if (!POSFIXABLE(xz) || xz / x != z) {
goto bignum; goto bignum;
} }
z = xz; z = xz;