FloatToStr function
Convert a float value to a string using a fixed format.
Declaration
function FloatToStr(Value: Extended): stringDescription
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);
Note that on unix systems, the localization support must be enabled explicitly, see Localization.
Errors
None.
See also
Example: ex67
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.An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.
