[Issue 21772] New: [REG2.069] Consecutive different-signed `double.nan`s in an array literal take the sign of the previous nan (same for `float` and `real`)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 27 08:57:18 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21772

          Issue ID: 21772
           Summary: [REG2.069] Consecutive different-signed `double.nan`s
                    in an array literal take the sign of the previous nan
                    (same for `float` and `real`)
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: n8sh.secondary at hotmail.com

Demonstration below. Bug does not appear in LDC.

---
void main()
{
    import std.stdio : writeln;
    import std.math : isIdentical;

    double[] a = [-double.nan, double.nan,  double.nan,
                          1.0, double.nan, -double.nan];
    writeln(a); // Writes "[-nan, -nan, -nan, 1, nan, nan]" (Uh-oh!)
    assert(!isIdentical(a[0], a[1])); // Fails of course.
}
---

--


More information about the Digitalmars-d-bugs mailing list