summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 06:56:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 06:56:10 +0000
commit890d25d46f30b5557c2cc1d66333fa48bdf76918 (patch)
treeae91d5cc0cada687d82ec26e18dd706d08bae1cc /numeric.c
parent1e23f4950d520522443037eead113b1fe364c244 (diff)
* numeric.c (int_pow): even number multiplication never be negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12697 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index 6734c836f1..7402f1527c 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2209,7 +2209,7 @@ int_pow(x, y)
z = xz;
}
} while (--y);
- if (neg) z = -z;
+ if (neg && (y & 1)) z = -z;
return LONG2NUM(z);
}