http://d.puremagic.com/issues/show_bug.cgi?id=5800
Summary: Wrong NAN bit pattern during array initialization Product: D Version: D2 Platform: Other OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: acehr...@yahoo.com --- Comment #0 from Ali Cehreli <acehr...@yahoo.com> 2011-03-30 15:02:28 PDT --- Environment: dmd 2.052, 64-bit Ubuntu. The following program passes the two asserts, showing that the array elements are not initialized as NANs. The dumpBytes() function shows that the bit pattern is different than a local variable's: import std.stdio; void main() { double[1] a; auto myNaN = double.nan; assert (a[0] != myNaN); // <-- passes; BUG assert (a[0] != double.nan); // <-- passes; BUG dumpBytes(a[0]); dumpBytes(myNaN); } void dumpBytes(T)(ref T var) { const ubyte * beg = cast(ubyte*)&var; foreach (bayt; beg .. beg + T.sizeof) { writef("%02x ", *bayt); } writeln(); } The bug manifests itself for float and real as well and the bit pattern changes depending on whether -m32 or -m64 is used. Here is one output of the program with -m64: 00 00 00 00 00 00 fc 7f 00 00 00 00 00 00 f8 7f Ali -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------