summaryrefslogtreecommitdiffstats
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
commite428bdb8546937c2bcb90ba413290e0335a45610 (patch)
tree4c625609d0a9e9c414dadc636c6b9e632dc03fd6 /numeric.c
parentc5a072c0df40ee0b25860b6553c3dc577c788e83 (diff)
downloadruby-e428bdb8546937c2bcb90ba413290e0335a45610.tar.gz
ruby-e428bdb8546937c2bcb90ba413290e0335a45610.tar.xz
ruby-e428bdb8546937c2bcb90ba413290e0335a45610.zip
* numeric.c (int_pow): even number multiplication never be negative.
git-svn-id: http://svn.ruby-lang.org/repos/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 f3b6387bf..eba69debb 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);
}