diff options
author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-14 01:16:44 +0000 |
---|---|---|
committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-14 01:16:44 +0000 |
commit | e4b3a817697a2ac04ecf7e6b4e62e92c54161236 (patch) | |
tree | 5809e4e36f761a07aab1fe7252840f8b625d153c /test/ruby | |
parent | 19416601a0af3b7c99a570ae6993cb29e4360e64 (diff) | |
download | ruby-e4b3a817697a2ac04ecf7e6b4e62e92c54161236.tar.gz |
* complex.c (f_{add,mul,sub}): omitted some shortcuts for preserve
signed zero anyway.
* complex.c (nucomp_negate): new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_complex.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index ef612e2279..6f9cabb7b9 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -303,6 +303,16 @@ class Complex_Test < Test::Unit::TestCase assert_equal(Complex(-1,1), +Complex(-1,1)) assert_equal(Complex(1,-1), +Complex(1,-1)) assert_equal(Complex(-1,-1), +Complex(-1,-1)) + + if -0.0.to_s == '-0.0' + c = +Complex(0.0,0.0) + assert_equal('0.0', c.real.to_s) + assert_equal('0.0', c.image.to_s) + + c = +Complex(-0.0,-0.0) + assert_equal('-0.0', c.real.to_s) + assert_equal('-0.0', c.image.to_s) + end end def test_negate @@ -313,6 +323,16 @@ class Complex_Test < Test::Unit::TestCase assert_equal(Complex(-1,1), -Complex(1,-1)) assert_equal(Complex(1,1), -Complex(-1,-1)) + if -0.0.to_s == '-0.0' + c = -Complex(0.0,0.0) + assert_equal('-0.0', c.real.to_s) + assert_equal('-0.0', c.image.to_s) + + c = -Complex(-0.0,-0.0) + assert_equal('0.0', c.real.to_s) + assert_equal('0.0', c.image.to_s) + end + =begin assert_equal(0, Complex(0).negate) assert_equal(-2, Complex(2).negate) |