int(X)

Returns the largest integer less than or equal to the given value. The result is an integer data type.

Syntax

int(X)

Input

Argument Type Description
X any simple type A numeric value (or a numeric value represented as text)

A scalar value or the name of a column

Return Value

Returns an integer value corresponding to the largest integer less than or equal to X.

If X is a decimal number, the result is the integer part of X cast to integer data type.

If X is an integer or decimal number represented as text, it is converted to the corresponding integer or decimal number. If the number is a decimal number, the result is the integer portion cast to integer data type.

If X is a value that cannot be converted to a numeric value or is N/A, the result is N/A.

Sample Usage

X int(X)
-5.25 -6
-5.0 -5
13 13
5.0 5
4.5 4
"3" 3
"7.25" 7
"-7.5" -8
NA NA

Example

In this example, the int(X) function returns the largest integer less than or equal to the given value on the sales column on the pub.demo.retail.item table.

<base table="pub.demo.retail.item"/>
<colord cols="transid, account, store, date, sku, sales"/>
<willbe name="intsales" value="int(sales)"/>