diff options
Diffstat (limited to 'libjava/java')
-rw-r--r-- | libjava/java/lang/Float.java | 10 |
1 files changed, 9 insertions, 1 deletions
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); |