summaryrefslogtreecommitdiffstats
path: root/libjava/java/lang/Float.java
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-16 04:06:33 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2002-01-16 04:06:33 +0000
commit9e55cc17c514e90df7d264f9fe0dd7b35dec9b46 (patch)
tree3924ea9da53671d684daf3f6ae1e210162fdf4ab /libjava/java/lang/Float.java
parentac4c192cfab5ef58d5bd746f46d6810383a772f8 (diff)
downloadppe42-gcc-9e55cc17c514e90df7d264f9fe0dd7b35dec9b46.tar.gz
ppe42-gcc-9e55cc17c514e90df7d264f9fe0dd7b35dec9b46.zip
2002-01-15 Tom Tromey <tromey@redhat.com>
* java/lang/Float.java (equals): Preserve old code. * java/lang/Double.java (equals): Preserve old code. 2002-01-15 Eric Blake <ebb9@email.byu.edu> * java/lang/Double.java (equals, compare): Fix 0.0 vs. -0.0 math. * java/lang/Float.java (equals, compare): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48895 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/Float.java')
-rw-r--r--libjava/java/lang/Float.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/libjava/java/lang/Float.java b/libjava/java/lang/Float.java
index e44503fbcd4..65caf430f54 100644
--- a/libjava/java/lang/Float.java
+++ b/libjava/java/lang/Float.java
@@ -1,5 +1,5 @@
/* java.lang.Float
- 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.
@@ -232,9 +232,12 @@ public final class Float extends Number implements Comparable
if (!(obj instanceof Float))
return false;
- Float f = (Float) obj;
+ float f = ((Float) obj).value;
- return floatToIntBits (value) == floatToIntBits (f.floatValue ());
+ // GCJ LOCAL: this implementation is probably faster than
+ // Classpath's, especially once we inline floatToIntBits.
+ return floatToIntBits (value) == floatToIntBits (f);
+ // END GCJ LOCAL
}
/**
@@ -484,10 +487,9 @@ public final class Float extends Number implements Comparable
return isNaN (y) ? 0 : 1;
if (isNaN (y))
return -1;
- if (x == 0.0 && y == -0.0)
- return 1;
- if (x == -0.0 && y == 0.0)
- return -1;
+ // recall that 0.0 == -0.0, so we convert to infinities and try again
+ if (x == 0 && y == 0)
+ return (int) (1 / x - 1 / y);
if (x == y)
return 0;
OpenPOWER on IntegriCloud