complex.c: multiply as rotation

* complex.c (nucomp_mul): calculate as rotation in complex plane
  if matrix calculation resulted in NaN.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-02-24 13:58:52 +00:00
parent 87e3aec84d
commit 3bcb10ad2a
3 changed files with 47 additions and 0 deletions

View file

@ -289,6 +289,13 @@ class Complex_Test < Test::Unit::TestCase
assert_equal(Complex(Rational(2,1),Rational(4)), c * Rational(2))
assert_equal(Complex(Rational(2,3),Rational(4,3)), c * Rational(2,3))
c = Complex(Float::INFINITY, 0)
assert_equal(Complex(Float::INFINITY, 0), c * Complex(1, 0))
assert_equal(Complex(0, Float::INFINITY), c * Complex(0, 1))
c = Complex(0, Float::INFINITY)
assert_equal(Complex(0, Float::INFINITY), c * Complex(1, 0))
assert_equal(Complex(-Float::INFINITY, 0), c * Complex(0, 1))
end
def test_div