Actions
Bug #15505
closedComplex#/ canonicalize rationals only when divisor is Complex
Actions
Like0
Like0Like0
Added by msnm (Masahiro Nomoto) over 6 years ago. Updated over 6 years ago.
In Ruby 2.6.0, Complex simplify division result when divisor is Complex, but does not when divisor is another class (Integer or Rational). This behavior seems to be less consistent: expected to simplify for all divisor.
https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/64610
p RUBY_VERSION #=> "2.6.0"
p Complex(4, 6) / Complex(2) #=> (2+3i)
p Complex(4, 6) / Integer(2) #=> ((2/1)+(3/1)*i)
Applied in changeset trunk|r66744.
complex.c (f_divide): canonicalize a quotient
Cannonicalize resultant real and imaginary parts when complex number
divided by non-complex number.
[Fix GH-2065] [Bug #15505] [ruby-core:90891]
From: Joe Peric peric.joe@gmail.com