[Issue 4155] New: return of NaN to temporary fails equality test

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon May 3 09:06:04 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4155

           Summary: return of NaN to temporary fails equality test
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: melvin.curran at googlemail.com


--- Comment #0 from melvin.curran at googlemail.com 2010-05-03 09:06:03 PDT ---
The problem is found in both DMD 1.059 and 2.044 and is demonstrated by the
following program - every answer should be false, but that is not the case.

import std.stdio;

T getnan(T)() { return T.nan; }

void main()
{
    float  f = 0.0;
    double d = 0.0;
    real   r = 0.0;

    writefln("before assigning NaN, float:%s, double:%s, real:%s", f, d, r);

    f = getnan!(float)();
    d = getnan!(double)();
    r = getnan!(real)();

    writefln(" float test, literal:%s, assign:%s, temporary:%s", (float.nan ==
0), (f == 0), (getnan!(float)() == 0));
    writefln("double test, literal:%s, assign:%s, temporary:%s", (double.nan ==
0), (d == 0), (getnan!(double)() == 0));
    writefln("  real test, literal:%s, assign:%s, temporary:%s", (real.nan ==
0), (r == 0), (getnan!(real)() == 0));
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list