Converts each element of the inputVector to integer in the manner dictated by the optional keyword used and stores the resulting integers in resultVariable. If the keyword is omitted, it is defaulted to truncate. There are four different ways to convert a floating point number to an integer.
If no keyword is present, the default conversion is truncate. Missing values (NaN or .) are unchanged by any of the conversion options. Zero is unchanged by any of the conversion options. Usage with the LET command The four different versions of INTEGER can be used as functions in the LET command but since LET doesn't accept keywords, each version is given its own name. These names are: INTEGER_TRUNCATE, INTEGER_FLOOR, INTEGER_CEILING, and INTEGER_ROUND. These names do not work as separate commands; they only work in the LET command. Since the default behavior of the INTEGER command is to truncate, you can use the name INTEGER as a synonym of INTEGER_TRUNCATE within a LET command. |
The following program shows the various INTEGER options in action: COPY (5.5 6.5 -1.5 1.5 1.9 -1.9 0 NaN) inVec INTEGER truncate inVec Trunc INTEGER floor inVec Floor INTEGER ceiling inVec Ceil INTEGER round inVec Round PRINT table inVec trunc2 floor ceil round Which has the output: inVec Trunc Floor Ceil Round 5.5 5 5 6 6 6.5 6 6 7 6 -1.5 -1 -2 -1 -2 1.5 1 1 2 2 1.9 1 1 2 2 -1.9 -1 -2 -1 -2 0.0E00 0.0E00 0.0E00 0.0E00 0.0E00 NaN NaN NaN NaN NaN |