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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 18 22:49:41 PST 2009


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


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au


--- Comment #1 from Don <clugdbug at yahoo.com.au> 2009-12-18 22:49:41 PST ---
(In reply to comment #0)
> It was pointed out that Phobos has isIdentical, but that doesn't work with
> literals for some reason:
> 
> float a;
> assert(isIdentical(a, float.init)) // fails!

That's because of the recently discovered NaN bug; the code generated for
uninitialized floats and doubles needs to change. It's not a problem with
isIdentical.

> But it shouldn't be this hard.  Why does 'is' do a bitwise compare for
> everything *except* floating point numbers?

> I propose that for floating point types, x is y be equivalent to a bitwise
> compare.  It is easy to say in the spec "x is y does a bitwise compare, which
> for all builtin types except for floating point types is equivalent to
> equality"

I think this would be a good idea. I've thought that several times myself. I
created the isIdentical() function because I think there's a need for it.

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