Method: Convert decimal/double to int
Function name: tointeger
Parameter list: (DECIMAL or DOUBLE)
Return type: INTEGER
What the method does: Converts the input decimal value to an integer; accepts decimal or double.
If there are fractional digits because the input value is a float or a decimal, then these digits to the right of the decimal point are truncated. For example:
-
tointeger(1.234567) results in -----> 1
-
tointeger(3.56789) results in -----> 3
If you want to “round”, then use either the round or the rounddecimal function:
Round, which accepts double, or decimal inputs, results in a rounded integer.
round(1.234567) results in -----> 1 (rounded down to 1)
round(3.56789) results in -----> 4 (rounded up to 4)
Rounddecimal rounds a decimal and has a decimal result.
rounddecimal(123.4567,3); results in -----> 123.457 (rounded to the nearest 3 decimal places)