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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 28 05:07:06 PDT 2011


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



--- Comment #18 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-06-28 05:02:11 PDT ---
(In reply to comment #7)
> Reopening as the commit above will cause the following assert to fail:
> static assert(real.init !is real.nan);

If they are not the same bit pattern, I think this is fine.  is should be a
bitwise compare.  I don't know enough about floating point to know whether they
are the same bit pattern.

In my understanding of floating point, this means that:

if(x is typeof(x).nan) ...

is not wise code -- it may fail if the exact nan bitpattern is different (my
understanding is that nan has multiple representations).  While it may be
unintuitive, that is no fault of D -- floating point is sometimes very
unintuitive.

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