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
commitb553a34c63da315637afeced46afd05d33f7c623 (patch)
tree4c625609d0a9e9c414dadc636c6b9e632dc03fd6 /numeric.c
parenta670571ad3ceab1ac1f1266f2b263640f2b11cc6 (diff)
* numeric.c (int_pow): even number multiplication never be negative.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@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 f3b6387bfa..eba69debb8 100644
--- a/numeric.c
+++ b/numeric.c
@@ -2304,7 +2304,7 @@ int_pow(long x, unsigned long y)
z = xz;
}
} while (--y);
- if (neg) z = -z;
+ if (neg && (y & 1)) z = -z;
return LONG2NUM(z);
}