DADiSP Worksheet Functions > Function Categories > Data Type Conversion > CASTINTEGER
Explicitly casts the input to an integer.
CASTINTEGER(val)
val |
- |
A scalar, series or table. |
An integer.
castinteger(1.9)
returns the integer 1.
castinteger(2.2)
returns the integer 2.
castinteger(3.7 + 8i)
returns the integer 3.
CASTINTEGER truncates real values to integers.
CASTINTEGER is helpful when writing SPL functions that require an explicit integer input and the type of the variable passed into the function may not be an integer.
If the input to CASTINTEGER is a series, it will only operate on the first point of the series. Use INT, FLOOR, CEIL or ROUND to convert an entire series or table.
If the input to CASTINTEGER is a table, it will only operate on the first point in the first column of the table.
CASTINTEGER can abbreviated CASTINT.