Can someone help me with the double.equals
with the following simple code:
Double value1 = Double.NaN;
Double value2 = Double.NaN;
boolean result1 = value1.equals(value2);
In Java result1 = true;
In web with GWt result1 = false;
Looking at the sourcecode i see that the java double has the following
equals method:
public boolean equals(Object obj) {
<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/lang/Double.java#l797>
return (obj instanceof Double)
<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/lang/Double.java#l798>
&& (doubleToLongBits(((Double)obj).value) ==
<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/lang/Double.java#l799>
doubleToLongBits(value));
<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/tip/src/share/classes/java/lang/Double.java#l800>
}
the GWT double source code shows the following:
@Override
public boolean equals(Object o) {
return checkNotNull(this) == o;
}
I do not really understand the GWT version. th emost important thing is
that the equals has different results between java and GWT.
How to resolve this?
Regards,
Jasper
--
You received this message because you are subscribed to the Google Groups "GWT
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-web-toolkit/74d1f4b1-2977-4496-b8eb-19b921215cc1n%40googlegroups.com.