diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-16 15:56:16 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-16 15:56:16 +0000 |
commit | 217db90e8705162bef4428c7d608a7d6fdf18b2a (patch) | |
tree | 84d1a784ac4b2ca0b0249a2db5431ad7ede46624 /test/ruby | |
parent | 8c3546c7441897721453866342828d91aba63b32 (diff) |
* 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/branches/ruby_1_8@12808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-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 57999d4b03..d17b1f8d49 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 |