DelphiBasics
FloatToStr
Function
Convert a floating point value to a string SysUtils unit
1  function FloatToStr ( Value : Extended ) : string;
2  function FloatToStr ( Value : Extended; const FormatSettings : TFormatSettings ) : string;
Description
The FloatToStr function converts a floating point number Value into a displayable string.
 
The value is displayed to 15 digits of precision.
 
The Value type may be any of the floating point types.
 
Values before the decimal point (the mantissa) exceeding the display capacity (15) result in a display using the exponent value, such as 1.2E9.
 
Version 2 of this function is for use within threads. You furnish the FormatSettings record before invoking the call. It takes a local copy of global formatting variables that make the routine thread safe.
Notes
You can change the decimal point value by setting the DecimalSeparator character.

Use the FloatToStrF function for control over the formatting.
Related commands
DecimalSeparator The character used to display the decimal point
FloatToStrF Convert a floating point value to a string with formatting
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Display various sizes of extended data values
var
  amount1, amount2, amount3 : Extended;
begin
  amount1 := 1234567890.123456789;  // High precision number
  amount2 := 1234567890123456.123;  // High mantissa digits
  amount3 := 1E100;                 // High value number

  ShowMessage('Amount1 = '+FloatToStr(amount1));
  ShowMessage('Amount2 = '+FloatToStr(amount2));
  ShowMessage('Amount3 = '+FloatToStr(amount3));
end;
Show full unit code
   Amount1 = 1234567890.12346
   Amount2 = 1.23456789012346E15
   Amount3 = 1E100
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page