Bug #15491
closedr62701 introduced the incompatibility of Complex#+, #-, and #* removing #ifndef PRESERVE_SIGNEDZERO
Description
In r62701, preprocessor conditions #ifndef PRESERVE_SIGNEDZERO
in f_add
, f_mul
, and f_sub
functions were removed.
These changes introduced the incompatibility for some special cases.
For example, the results of the following code shows the different sign of the imaginary part:
p Complex(-0.0, 0) * Complex(0, 0)
#=> (-0.0+0.0i) on 2.5.3
#=> (-0.0-0.0i) on 2.6.0
Moreover, the following code shows the different values in the real part:
class Integer
def +(*); 42; end
end
p Complex(1, 2) + Complex(0, 1)
#=> (42+42i) on 2.5.3
#=> (0+42i) on 2.6.0
Updated by mrkn (Kenta Murata) about 6 years ago
I made a patch https://github.com/ruby/ruby/pull/2062
Updated by mrkn (Kenta Murata) about 6 years ago
- Status changed from Assigned to Closed
Applied in changeset trunk|r66688.
complex.c: fix against redefining component methods
This fixes the incompatibility (maybe unintentionally) introduced by
removal of #ifndef PRESERVE_SIGNEDZERO
guards in f_add, f_mul, and
f_sub functions in r62701. [Bug #15491] [ruby-core:90843]
Updated by naruse (Yui NARUSE) about 6 years ago
- Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED
Updated by naruse (Yui NARUSE) about 6 years ago
- Backport changed from 2.4: DONTNEED, 2.5: DONTNEED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONTNEED, 2.6: DONE
ruby_2_6 r66854 merged revision(s) 66681,66682,66684,66688,66697,66751,66693,66694.