The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



AutoFormatData


Unit:SDL_stringl
Class: None
Declaration: [1] function AutoFormatData (data: double; SigDig: integer): string;
[2] function AutoFormatData (data: double; SigDig: integer; UseComma: boolean): string;

The function AutoFormatData converts the parameter data to a string using a representation according to the following guidelines: (1) if the absolute value is greater than 10SigDig-1 or less than 0.1 the value is converted to exponential notation. (2) Numbers between those two boundaries are converted using a floating point representation. (3) The number of decimal places is adjusted in a way that SigDig significant digits are used. Any additional digits are rounded off.

AutoFormatData comes in two overloaded forms: version [1] always uses a dot as the decimal separator, while version [2] replaces the dot separator by a comma if the parameter UseComma is TRUE.

Examples:
Value SigDig formatted string
0
1
-0.1
-18.87126591
8E3
77.21
9826712871
4
3
8
8
7
6
4
0.000
1.00
-1.0000000E-01
-18.871266
8000.000
77.2100
9.827+09
     



Last Update: 2023-Feb-06