INT Function
Returns the whole number, fuzzed to avoid unexpected floating-point results.
| Category: | Truncation |
|---|---|
| Returned data type: | DOUBLE |
Table of Contents
Syntax
Required Argument
expression
specifies any expression that evaluates to a numeric value.
| Data type | DOUBLE |
|---|---|
| See | <sql-expression> Expression |
| FedSQL Expressions |
Details
In FedSQL, INT is a reserved word. To use the function, you must specify the function name as a delimited identifier.
The INT function returns the whole number portion of the argument (truncates the decimal portion). If the argument's value is within 1E-12 of a whole number, the function results in that whole number. If the value of expression is positive, the INT function has the same result as the FLOOR function. If the value of expression is negative, the INT function has the same result as the CEIL function.
Comparisons
Unlike the INTZ function, the INT function fuzzes the result. If the argument is within 1E-12 of a whole number, the INT function fuzzes the result to be equal to that whole number. The INTZ function does not fuzz the result. Therefore, with the INTZ function, you might get unexpected results.
Example
The following statements illustrate the INT function:
|
Statements |
Results |
|---|---|
|
|
|
|
|
|
|
|