Share via


Float.toString

Class Overview | Class Members | This Package | All Packages

Syntax

public static String toString( float f )

Parameters
  • d
    the float to be converted.
Returns

a string representation of the argument.

Description

Returns a String representation for the specified float value.

The values NaN, NEGATIVE_INFINITY, POSITIVE_INFINITY, -0.0, and +0.0 are represented by the strings "NaN", "-Infinity", "Infinity", "-0.0", and "0.0", respectively.

If d is in the range 10-3 <= |d| <= 107, then it is converted to a String in the style [-]ddd.ddd. Otherwise, it is converted to a string in the style [-]m.ddddE±xx.

There is always a minimum of 1 digit after the decimal point. The number of digits is the minimum needed to uniquely distinguish the argument value from adjacent values of type float.