[Issue 3632] modify float is float to do a bitwise compare

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jun 26 01:42:22 PDT 2011


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


kennytm at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |kennytm at gmail.com
         Resolution|FIXED                       |


--- Comment #5 from kennytm at gmail.com 2011-06-26 01:37:29 PDT ---
This is *not yet fixed*. The current implementation in DMD


           real_t v1 = e1->toReal();
           real_t v2 = e2->toReal();
           cmp = !memcmp(&v1, &v2, sizeof(real_t));


will not work, at least on OS X, because while 'real_t' ('long double') is only
a 80-bit floating point number (occupying 10 bytes), with alignment
'sizeof(real_t)' will take 16 bytes. The extra 6 bytes of paddings are often
filled with garbage. This makes even

       4.0 is 4.0

to return 'false'.

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