Overture Search the Web.
Type it and go!
 
 
 
 

4Test Tips - Val Function

Val function gives wrong answer for large values

The Val function returns an INTEGER if the input STRING parameter does not have a decimal point.  It returns a REAL number whenever the input STRING has a decimal point.  This behavior is independent of the data type that is to receive the returned value.  There is no warning message when the input STRING represents a number greater than 32-bits in binary, but all bit values above 32 will be lost if the input does not contain a period.

4Test Solution - Make sure the input STRING parameter to the Val function has a decimal point

    REAL rValue
    if StrPos(".",sInput)==0
        sInput = sInput+"."
    rValue = Val(sInput)

TestMap Extensions Solution - use the TmValBaseN function.

    REAL rValue
    rValue = TmValBaseN(sInput)

 
 

Send questions or comments about this web site to: webmaster@TestMap.com
Copyright © 1998,2001 Charles B. Hedstrom