diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-01 07:34:31 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-09-01 07:34:31 +0000 |
commit | d32b1875b721c092cf8de752e90c15c5098c8301 (patch) | |
tree | abb04468573060b8a2ee3a5c56cbd717d0cfbb1a /test | |
parent | 13af993e733ab4de4088b9d9bd24b360f5fcd19f (diff) | |
download | ruby-d32b1875b721c092cf8de752e90c15c5098c8301.tar.gz |
complex.c: simplify division result
* complex.c (f_divide): canonicalize rationals to simplify integer
complex results.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_complex.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_complex.rb b/test/ruby/test_complex.rb index d8d8fb9cd6..10289226fe 100644 --- a/test/ruby/test_complex.rb +++ b/test/ruby/test_complex.rb @@ -323,6 +323,13 @@ class Complex_Test < Test::Unit::TestCase assert_equal(Complex(Rational(1,2),Rational(1)), c / Rational(2)) assert_equal(Complex(Rational(3,2),Rational(3)), c / Rational(2,3)) + + c = Complex(1) + r = c / c + assert_instance_of(Complex, r) + assert_equal(1, r) + assert_predicate(r.real, :integer?) + assert_predicate(r.imag, :integer?) end def test_quo |