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



ScanFPNum


Unit:SDL_math1
Class: none
Declaration: function ScanFPNum (Instring: string; AllowExp: boolean; DecPChar: integer; var Idx: integer): double;

The function ScanFPNum decodes a decimal floating point number from a string. The parameter Instring contains the decimal number to be scanned, starting at the position defined by the parameter Idx. Valid characters are the digits 0...9, E, ., leading - and + signs, and leading blanks. If the parameter AllowExp is set TRUE the scanned number may be optionally stored in exponential notation. The parameter DecPChar determines which character is accepted as decimal separator:

DecPChar accepted character
1 dot
2 comma
3 both

On return, ScanFPNum contains the corresponding floating point number, and the variable parameter Idx points to the first character after the scanned number. If the number constitutes the final part of the string, Idx points to 1+length(Instring ).

Hint1 : If ScanFPNum encounters a number which is greater than uc_MaxDouble, or less than -uc_MaxDouble, a value of uc_MaxDouble (-uc_MaxDouble) is returned.

Hint 2: If DecPChar is set to 3, the input string InString is interpreted slightly different concerning the decimal separators. While repeated decimal separators result in an error if DecPChar is not 3, a second decimal separator is treated as a normal separator (i.e. a blank) if DecPChar is set to 3.



Last Update: 2012-Oct-20