[Issue 7546] 64-bit floating-point issue with negative zero: -0.0 == 0.0 is false.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 19 11:38:42 PST 2012


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



--- Comment #1 from kennytm at gmail.com 2012-02-19 11:38:41 PST ---
The problem is that, when comparing with 0.0 or -0.0, the backend will generate
an integer 'cmp' instruction, but -0.0 has a different bit pattern than 0.0, so
the equality will fail.

     cmp    QWORD PTR [rbp-0x8],0x0
     je     ...

The code works if the type is 'float' because it uses an 'add eax, eax' trick
make both 0.0f and -0.0f set the ZF flag.

This code also work if the type if 'real' because it uses x87.

-- 
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