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....


Unit: SDL_stringl
Class: None
Declaration: [1] function SigDigStr (data: double; Width, NSigDig: integer): string;
[2] function SigDigStr (data: double; Width, NSigDig: integer; NoBlanks: boolean): string;

The function SigDigStr converts the numerical value data into a string of length Width showing NSigDig significant digits. (Note the difference between number of decimal places and number of significant digits).

The optional parameter NoBlanks (Version [2]) suppresses any leading blanks if set to TRUE. Please note that, for example, SigDigStr(xx,8,4,true) is not the same as SigDigStr(xx,1,4,false). Following are the results for different parameters (assuming that xx = 23.12345, the resulting blanks are indicated by the tilde sign ~):


Hint: The number of significant digits is not restricted if data is greater than 10NSigSig.

Example: Assuming x to be 23.725821 the statement astr := SigDigStr(x,10,5); assigns the string '    23.726' to the variable 'astr'. The length of astr is 10, the value of x is rounded to 5 significant digits.

Last Update: 2013-Dec-06