See Also: Type Conversion Functions, Integer, Real, Round, String
The Number function returns a value of type Number from an input of another type.
(Number( {expression} ))
Number eliminates the portion to the right of the eighth digit after the decimal point from the value of a variable.
Move (Number(3.14159265359)) To nPI
In this example, the value 3.14159265 is moved to the variable nPI. The digits more than eight places to the right of the decimal point are truncated.
The Number function does not change the type of its {expression} parameter. It only affects its precision.
When the absolute value of {expression} exceeds the maximum range of a DataFlex Number (+/-99,999,999,999,999.99999999), the leading digits in the value are truncated, and no error is declared.
When used inside an expression, number affects the precision of the overall expression, unless a function converting to a lower order of precision contains the number expression.
Integer iMean
Number nResult
Move (3.14 * Number(iMean)) To nResult
This example would output 3.14 times the value of the integer variable iMean to the number variable nResult in the full precision of numbers.
Database fields in DataFlex that are capable of holding quantities are all of type number. There is no field data type to hold floating-point (real) values. If you move a real value to a field, or number-type window or variable, the value will be converted to a number automatically.