FLOOR Function

Returns the largest integer less than or equal to a numeric value expression.

Category: Truncation
Returned data type: DECIMAL, DOUBLE, NUMERIC

Syntax

FLOOR(expression)

Arguments

expression

specifies any valid expression that evaluates to a numeric value.

Data type DECIMAL, DOUBLE, NUMERIC
See <sql-expression>
FedSQL Expressions

Details

If expression is within 1E-12 of an integer, the function returns that integer. If the result is a number that does not fit into the range of a DOUBLE, the FLOOR function fails.
If the argument is DECIMAL, the result is DECIMAL. Otherwise, the argument is converted to DOUBLE (if not so already), and the result is DOUBLE.

Comparisons

The FLOOR function fuzzes the results so that if the results are within 1E-12 of an integer, the FLOOR function returns that integer. The FLOORZ function uses zero fuzzing. Therefore, with the FLOORZ function, you might get unexpected results.

Example

Table: DENSITIES
The following statement illustrates the FLOOR function:
Statements
Results
select floor(1.95);
1
select floor(density) from densities;
67
306
30
323
20
383
31
309
6
247
Last updated: February 23, 2017