CASTINTEGER

Purpose:

Explicitly casts the input to an integer.

Syntax:

CASTINTEGER(val)

val

-

A scalar, series or table.

Returns:

An integer.

Example:

castinteger(1.9)

 

returns the integer 1.

Example:

castinteger(2.2)

 

returns the integer 2.

Example:

castinteger(3.7 + 8i)

 

returns the integer 3.

Remarks:

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.

See Also:

CASTCOMPLEX

CASTHANDLE

CASTREAL

CASTSERIES

CASTSTRING

CASTWINDOW

INT