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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 18 06:43:03 PDT 2011


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



--- Comment #19 from Steven Schveighoffer <schveiguy at yahoo.com> 2011-07-18 06:37:46 PDT ---
(In reply to comment #18)
> (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.

I think I misread the above.  If the above assert fails, and they are different
bit patterns, this is definitely a problem.  Two different bit patterns should
fail to compare as equal.

== can do the intelligent standards-conforming thing, but 'is' should do
bitwise comparison.  If it doesn't, then you cannot use it as a tool to verify
low-level manipulation (such as allocating memory with a pre-defined value) is
working.  And I don't see the point of using 'is' on floating points otherwise,
it's misleading.

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