Tor Iver Wilhelmsen coughed up:
"Thomas G. Marshall"
No, that's not what he's saying. equals() is not about mathematical
equivalence.
No? For the Double, or any other arithmetic class it had /better/ be.
"equals()" is about whatever version of equivalence the author intended it
to be, mathematical or otherwise.
Here's the comment for (Double).equals(): I've marked the equivalence rule
with its exceptions.
<yank>
Compares this object against the specified object. The result is true if and
only if the argument is not null and is a Double object that represents a
double that has the same value as the double represented by this object. For
this purpose, two double values are considered to be the same if and only if
the method doubleToLongBits(double) returns the identical long value when
applied to each.
Note that in most cases, for two instances of class Double, d1 and d2, the
value of d1.equals(d2) is true if and only if
* d1.doubleValue() == d2.doubleValue() *
also has the value true. However, there are *two exceptions* :
If d1 and d2 both represent Double.NaN, then the equals method returns true,
even though Double.NaN==Double.NaN has the value false.
If d1 represents +0.0 while d2 represents -0.0, or vice versa, the equal
test has the value false, even though +0.0==-0.0 has the value true.
</yank>