System.SysUtils.FloatToStr

From Appmethod Libraries
Jump to: navigation, search

Object Pascal

function FloatToStr(Value: Extended): string;
function FloatToStr(Value: Extended; const AFormatSettings: TFormatSettings): string;

C++

extern DELPHI_PACKAGE System::UnicodeString __fastcall FloatToStr(System::Extended Value)/* 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.

FloatToStr converts the floating-point value given by Value to its string representation. The conversion uses general number format with 15 significant digits.

For greater control over the formatting of the string, use the FloatToStrF function.

The first form of FloatToStr is not thread-safe, because it uses localization information contained in global variables. The second form of FloatToStr, which is thread-safe, refers to localization information contained in the AFormatSettings parameter. Before calling the thread-safe form of FloatToStr, you must populate AFormatSettings with localization information. To populate AFormatSettings with a set of default locale values, call TFormatSettings.Create.

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'.

See Also

Code Examples