[Issue 8745] floating point comparison ("is" vs "==") inconsistency (on 32)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 2 01:19:03 PDT 2012


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



--- Comment #2 from monarchdodra at gmail.com 2012-10-02 01:19:17 PDT ---
(In reply to comment #1)
> The idea that for floating point, 'is' and '==' should be the same, is wrong.
> See bug 3632 for further discussion. I suspect this is a duplicate of the
> issues raised there.

I read the thread, it mostly relates to how comparison is done in regards to
NaN and 0. Here, we are dealing with a "normal" float.

It mentions doing an "isIdentical" call if you really want binary comparison:

//----
void main()
{
    writeln(isIdentical(getFloat(), getFloat()));
    writeln(getFloat() is getFloat());
    writeln(getFloat() == getFloat());
}
//----
true
true
false
//----

:/

So, to get this straight, I got a and b. "a is b" and "a is is identical to b"
but "a != b" ? (!)

Is that really the intended behavior? If so, can you explain what I am seeing?
I'm more confused than trying to request a change of behavior, really.

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