Creates a String representation of the specified Single value.
[Visual Basic] Overloads Public Shared Function ToString( _ ByVal f As Single _ ) As String [C#] public static string ToString( float f ); [C++] public: static String* ToString( float f ); [JScript] public static function ToString( f : float ) : String;
The string representation of the specified Single value.
The string representation produced does not depend upon the user's settings.
The format is produced as if Format were called with the argument f, the general format ('G') character, and the invariant NumberFormatInfo. (In addition for addition inforamtion on cultures, see CultureInfo.)
To create user-dependent or locale-specific strings, use the Format method with an appropriate NumberFormatInfo object.
The following conditions apply to the f
parameter:
Suppose f is positive. The string will be composed of the integer part of f, followed by the character '.', followed by the fractional part of f.
Suppose f is negative. The string will be composed of the character '-', followed by the integer part of f, followed by the character '.', followed by the fractional part of f.
The representation always uses the least number of digits required to represent the Single value.
If f is a Single value such that either | f | < 10-4 or | f | > = 109, then the result will be a string in exponential format as discussed below (e.g., 0.00001234 is represented as "1.234E-5"):
Suppose f is positive. Let n be the unique integer such that 10n-1 < = f < 10n. Then 1 < = f/ 10n-1 < 10. The string will be composed of the floor of the mathematical quotient f/ 10n-1, followed by the character '.', followed by the fractional part of the mathematical quotient f/ 10n-1, followed by the character 'E', followed by the character '-', followed by the integer n.
Suppose f is negative. Then the result will be the same as above, except that the floor of the mathematical quotient f/ 10n-1 will be preceded by the character '-'.
The representation always uses the least number of digits required to represent the Single value, in both the mantissa and the exponent.
If f is a Single value equal to either NaN, PositiveInfinity, or NegativeInfinity, the result will be "NaN", "Infinity", or "-Infinity", respectively.
Single Structure | Single Members | System Namespace | Single.ToString Overload List