help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

FloatToStr

Convert a float value to a string using a fixed format.

Declaration

Source position: line 0

function FloatToStr(

  Value: Double

):String;

function FloatToStr(

  Value: Double;

  const FormatSettings: TFormatSettings

):String;

function FloatToStr(

  Value: Single

):String;

function FloatToStr(

  Value: Single;

  const FormatSettings: TFormatSettings

):String;

function FloatToStr(

  Value: Currency

):String;

function FloatToStr(

  Value: Currency;

  const FormatSettings: TFormatSettings

):String;

function FloatToStr(

  Value: Comp

):String;

function FloatToStr(

  Value: Comp;

  const FormatSettings: TFormatSettings

):String;

function FloatToStr(

  Value: Int64

):String;

function FloatToStr(

  Value: Int64;

  const FormatSettings: TFormatSettings

):String;

Description

FloatToStr converts the floating point variable Value to a string representation. It will choose the shortest possible notation of the two following formats:

Fixed format
will represent the string in fixed notation,
Decimal format
will represent the string in scientific notation.

More information on these formats can be found in FloatToStrF. FloatToStr is completely equivalent to the following call:

FloatToStrF(Value, ffGeneral,15, 0);

Errors

None.

See also

FloatToStrF

  

Convert a float value to a string using a given format.

FormatFloat

  

Format a float according to a certain mask.

StrToFloat

  

Convert a string to a floating-point value.

Example

Program Example67;

{ This program demonstrates the FloatToStr function }

Uses sysutils;

Procedure Testit (Value : Extended);

begin
  Writeln (Value,' -> ',FloatToStr(Value));
  Writeln (-Value,' -> ',FloatToStr(-Value));
end;

Begin
  Testit (0.0);
  Testit (1.1);
  Testit (1.1e-3);
  Testit (1.1e-20);
  Testit (1.1e-200);
  Testit (1.1e+3);
  Testit (1.1e+20);
  Testit (1.1e+200);
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505