System.SysUtils.FloatToStrF
Delphi
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer): string;
function FloatToStrF(Value: Extended; Format: TFloatFormat; Precision, Digits: Integer; const AFormatSettings: TFormatSettings): string;
C++
extern DELPHI_PACKAGE System::UnicodeString __fastcall FloatToStrF(System::Extended Value, TFloatFormat Format, int Precision, int Digits)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | System.SysUtils.pas System.SysUtils.hpp |
System.SysUtils | System.SysUtils |
Description
Converts a floating point Value
to a string, using a specified Format
, Precision
, and Digits
.
FloatToStrF converts the floating-point value given by Value
to its string representation.
The Value
parameter is the value to convert.
The Precision
parameter specifies the precision of the given value. It should be 7 or less for values of type Single, 15 or less for values of type 'Double, and 18 or less for values of type Extended.
The Digits
and Format
parameters together control how the value is formatted into a string. For details, see the description of TFloatFormat.
If the given value is a NAN (not-a-number), the resulting string is 'NAN'
. If the given value is positive infinity, the resulting string is 'INF'
. If the given value is negative infinity, the resulting string is '-INF'
.
The first form of FloatToStrF is not thread-safe, because it uses localization information contained in global variables. The second form of FloatToStrF, which is thread-safe, refers to localization information contained in the FormatSettings parameter. Before calling the thread-safe form of FloatToStrF, you must populate FormatSettings with localization information. To populate FormatSettings with a set of default locale values, call TFormatSettings.Create.
See Also
- Type conversion routines
- System.SysUtils.TFloatFormat
- System.SysUtils.TFormatSettings.Create
- System.SysUtils.FormatSettings