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

FloatToStr

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

Declaration

Source position: sysstrh.inc line 158

function FloatToStr(

  Value: Extended

):string;

function FloatToStr(

  Value: Extended;

  const FormatSettings: TFormatSettings

):string;

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.

Documentation generated on: Mar 17 2017