From: muraken@... Date: 2019-01-01T17:33:41+00:00 Subject: [ruby-core:90843] [Ruby trunk Bug#15491] r62701 introduced the incompatibility of Complex#+, #-, and #* removing #ifndef PRESERVE_SIGNEDZERO Issue #15491 has been reported by mrkn (Kenta Murata). ---------------------------------------- Bug #15491: r62701 introduced the incompatibility of Complex#+, #-, and #* removing #ifndef PRESERVE_SIGNEDZERO https://bugs.ruby-lang.org/issues/15491 * Author: mrkn (Kenta Murata) * Status: Assigned * Priority: Normal * Assignee: mrkn (Kenta Murata) * Target version: * ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- 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 ``` -- https://bugs.ruby-lang.org/ Unsubscribe: