summaryrefslogtreecommitdiff
path: root/test/ruby/test_fixnum.rb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-14 14:31:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-14 14:31:21 +0000
commit7f0bb427e09ab985da52217f792c292ba9d0c556 (patch)
tree8c819ec7470696280d10f72a832d7f3f6e1b0a55 /test/ruby/test_fixnum.rb
parentbb44ba9b72adf41dc17714351df724bc5c21bd7a (diff)
downloadruby-7f0bb427e09ab985da52217f792c292ba9d0c556.tar.gz
* numeric.c (fix_pow): integer power calculation: 0**n => 0,
1**n => 1, -1**n => 1 (n: even) / -1 (n: odd). * test/ruby/test_fixnum.rb (TestFixnum::test_pow): update test suite. pow(-3, 2^64) gives NaN when pow(3, 2^64) gives Inf. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_fixnum.rb')
-rw-r--r--test/ruby/test_fixnum.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb
index 13281ca0ea..81a091eb40 100644
--- a/test/ruby/test_fixnum.rb
+++ b/test/ruby/test_fixnum.rb
@@ -12,7 +12,7 @@ class TestFixnum < Test::Unit::TestCase
def test_pow
[1, 2, 2**64, 2**63*3, 2**64*3].each do |y|
- [1, 3].each do |x|
+ [-1, 0, 1].each do |x|
z1 = x**y
z2 = (-x)**y
if y % 2 == 1