diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-14 14:31:21 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-14 14:31:21 +0000 |
commit | b93d9cf2d03c2491e1bdaa0465b2de45cd119f65 (patch) | |
tree | 8c819ec7470696280d10f72a832d7f3f6e1b0a55 /test/ruby/test_fixnum.rb | |
parent | b64110924a5151d7381ba6805a207968e1c37ea6 (diff) | |
download | ruby-b93d9cf2d03c2491e1bdaa0465b2de45cd119f65.tar.gz ruby-b93d9cf2d03c2491e1bdaa0465b2de45cd119f65.tar.xz ruby-b93d9cf2d03c2491e1bdaa0465b2de45cd119f65.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@12789 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_fixnum.rb')
-rw-r--r-- | test/ruby/test_fixnum.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ruby/test_fixnum.rb b/test/ruby/test_fixnum.rb index 13281ca0e..81a091eb4 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 |