diff options
Diffstat (limited to 'libjava/java/lang/Double.java')
-rw-r--r-- | libjava/java/lang/Double.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libjava/java/lang/Double.java b/libjava/java/lang/Double.java index 773e882..87f5d03 100644 --- a/libjava/java/lang/Double.java +++ b/libjava/java/lang/Double.java @@ -1,5 +1,5 @@ /* Double.java -- object wrapper for double primitive - Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -163,9 +163,12 @@ public final class Double extends Number implements Comparable if (!(obj instanceof Double)) return false; - Double d = (Double) obj; + double d = ((Double) obj).value; - return doubleToLongBits (value) == doubleToLongBits (d.doubleValue ()); + // GCJ LOCAL: this implementation is probably faster than + // Classpath's, especially once we inline doubleToLongBits. + return doubleToLongBits (value) == doubleToLongBits (d); + // END GCJ LOCAL } /** @@ -334,10 +337,9 @@ public final class Double extends Number implements Comparable return isNaN (y) ? 0 : 1; if (isNaN (y)) return -1; - if (x == 0.0d && y == -0.0d) - return 1; - if (x == -0.0d && y == 0.0d) - return -1; + // recall that 0.0 == -0.0, so we convert to infinites and try again + if (x == 0 && y == 0) + return (int) (1 / x - 1 / y); if (x == y) return 0; |