src/share/classes/java/lang/Float.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1994, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -201,11 +201,11 @@
*
* @param f the float to be converted.
* @return a string representation of the argument.
*/
public static String toString(float f) {
- return new FloatingDecimal(f).toJavaFormatString();
+ return FloatingDecimal.toJavaFormatString(f);
}
/**
* Returns a hexadecimal string representation of the
* {@code float} argument. All characters mentioned below are
@@ -419,11 +419,11 @@
* represented by the {@code String} argument.
* @throws NumberFormatException if the string does not contain a
* parsable number.
*/
public static Float valueOf(String s) throws NumberFormatException {
- return new Float(FloatingDecimal.readJavaFormatString(s).floatValue());
+ return new Float(parseFloat(s));
}
/**
* Returns a {@code Float} instance representing the specified
* {@code float} value.
@@ -454,11 +454,11 @@
* parsable {@code float}.
* @see java.lang.Float#valueOf(String)
* @since 1.2
*/
public static float parseFloat(String s) throws NumberFormatException {
- return FloatingDecimal.readJavaFormatString(s).floatValue();
+ return FloatingDecimal.parseFloat(s);
}
/**
* Returns {@code true} if the specified number is a
* Not-a-Number (NaN) value, {@code false} otherwise.