User Guide
244
float()
Syntax
(expression).float
float (expression)
Description
Function; converts an expression to a floating-point number. The number of digits that follow
the decimal point (for display purposes only, calculations are not affected) is set using the
floatPrecision property.
Examples
This statement converts the integer 1 to the floating-point number 1:
put (1).float
-- 1.0
Math operations can be performed using float; if any of the terms is a float value, the entire
operation is performed with
float:
"the floatPrecision = 1
put 2 + 2
-- 4
put (2).float + 2
-- 4.0
the floatPrecision = 4
put 22/7
-- 3
put (22).float / 7
-- 3.1429"
See also
floatPrecision, ilk()
floatP()
Syntax
(expression).floatP
floatP(expression)
Description
Function; indicates whether the value specified by expression is a floating-point number (1 or
TRUE) or not (0 or FALSE).
The P in
floatP stands for predicate.
Examples
This statement tests whether 3.0 is a floating-point number. The Message window displays the
number 1, indicating that the statement is
TRUE.
put (3.0).floatP
-- 1
This statement tests whether 3 is a floating-point number. The Message window displays the
number 0, indicating that the statement is
FALSE.
put (3).floatP
-- 0
See also
float(), ilk(), integerP(), objectP(), stringP(), symbolP()