Int
PowerScript function
Description
Determines the largest whole number less than or equal to a
number.
Syntax
|
1 |
Int ( n ) |
|
Argument |
Description |
|---|---|
|
n |
The number for which you want the largest whole number |
Return value
Integer.
Returns the largest whole number less than or equal to n. If n is
too small or too large to be represented as an integer, Int returns 0. If
n is null, Int returns null.
Usage
When the result for Int would be smaller than -32768 or larger than
32767, Int returns 0 because the result cannot be represented as an
integer.
Examples
These statements return 3.0:
|
1 2 |
Int(3.2) Int(3.8) |
The following statements return -4.0:
|
1 2 |
Int(-3.2) Int(-3.8) |
These statements remove the decimal portion of the variable and
store the resulting integer in li_nbr:
|
1 2 |
integer li_nbr li_nbr = Int(3.2) // li_nbr = 3 |
See also
Int method for DataWindows in the section called “Int” in DataWindow Reference.