Project

General

Profile

Actions

Bug #15505

closed

Complex#/ canonicalize rationals only when divisor is Complex

Added by msnm (Masahiro Nomoto) almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:90891]

Updated by msnm (Masahiro Nomoto) almost 6 years ago

  • Subject changed from Ck to Complex#/ canonicalize rationals only when divisor is Complex
  • ruby -v set to 2.6.0

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)
Actions #2

Updated by mrkn (Kenta Murata) almost 6 years ago

  • Status changed from Open to Closed

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

Actions

Also available in: Atom PDF

Like0
Like0Like0