aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-02-09 02:21:27 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-02-09 02:21:27 +0000
commit1c8b24ad46bf91f783be499851b08d0eaf7ca8c6 (patch)
tree137f3a06cae0cf5717f613b5ae73a89fc2f90392
parent34ce3d7ba5a482d79a56dcbdfe72c7fbf5932c63 (diff)
downloadgcc-1c8b24ad46bf91f783be499851b08d0eaf7ca8c6.zip
gcc-1c8b24ad46bf91f783be499851b08d0eaf7ca8c6.tar.gz
gcc-1c8b24ad46bf91f783be499851b08d0eaf7ca8c6.tar.bz2
* java/lang/Float.java (parseFloat): New method.
From-SVN: r39555
-rw-r--r--libjava/ChangeLog4
-rw-r--r--libjava/java/lang/Float.java10
2 files changed, 13 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 6e0a7b9..7c9ca24 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,9 @@
2001-02-08 Tom Tromey <tromey@redhat.com>
+ * java/lang/Float.java (parseFloat): New method.
+
+2001-02-08 Tom Tromey <tromey@redhat.com>
+
From paul@dawa.demon.co.uk. Fix for PR libgcj/1913:
* java/io/InputStreamReader.java (ready, read): Throw IOException
if stream has been closed.
diff --git a/libjava/java/lang/Float.java b/libjava/java/lang/Float.java
index 5733752..4a1f7fe 100644
--- a/libjava/java/lang/Float.java
+++ b/libjava/java/lang/Float.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -49,6 +49,14 @@ public final class Float extends Number implements Comparable
this.value = valueOf (s).floatValue ();
}
+ public static float parseFloat (String s) throws NumberFormatException
+ {
+ // The spec says that parseFloat() should work like
+ // Double.valueOf(). This is equivalent, in our implementation,
+ // but more efficient.
+ return (float) Double.parseDouble (s);
+ }
+
public String toString ()
{
return toString (value);