aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/Float.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@gcc.gnu.org>2000-11-17 04:51:25 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-11-17 04:51:25 +0000
commit98182da528e7b84a12d0c01e5d8efdb1d0670141 (patch)
tree589f95defa08868b8681949b702699d1636b17ef /libjava/java/lang/Float.java
parentdd3b81b4218512cfedc271dfde65c6011b6aefe9 (diff)
downloadgcc-98182da528e7b84a12d0c01e5d8efdb1d0670141.zip
gcc-98182da528e7b84a12d0c01e5d8efdb1d0670141.tar.gz
gcc-98182da528e7b84a12d0c01e5d8efdb1d0670141.tar.bz2
PushbackReader.java: Merged with Classpath.
* java/io/PushbackReader.java: Merged with Classpath. * java/util/Arrays.java: Updated from Classpath. * scripts/blocks.pl: New file. * java/lang/Character.java (Subset): New class. (UnicodeBlock): New class. * java/lang/Math.java (toDegrees, toRadians): New methods. * java/lang/Float.java: Implement Comparable. (compareTo): New methods. * java/lang/Double.java: Implement Comparable. (compareTo): New methods. From-SVN: r37512
Diffstat (limited to 'libjava/java/lang/Float.java')
-rw-r--r--libjava/java/lang/Float.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/libjava/java/lang/Float.java b/libjava/java/lang/Float.java
index b5939de..5733752 100644
--- a/libjava/java/lang/Float.java
+++ b/libjava/java/lang/Float.java
@@ -18,7 +18,7 @@ package java.lang;
* Status: Believed complete and correct.
*/
-public final class Float extends Number
+public final class Float extends Number implements Comparable
{
public static final float MAX_VALUE = 3.4028235e+38f;
public static final float MIN_VALUE = 1.4e-45f;
@@ -147,5 +147,25 @@ public final class Float extends Number
public static native float intBitsToFloat (int bits);
-}
+ public int compareTo (Float d)
+ {
+ float v = d.value;
+ if (isNaN (value))
+ return isNaN (v) ? 1 : 0;
+ else if (isNaN (v))
+ return -1;
+ else if (value == 0.0 && v == -0.0)
+ return 1;
+ else if (value == -0.0 && v == 0.0)
+ return -1;
+ else if (value == v)
+ return 0;
+
+ return value > v ? 1 : -1;
+ }
+ public int compareTo (Object o)
+ {
+ return compareTo ((Float) o);
+ }
+}