FLOOR¶
Calculates the largest integer smaller or equal to the numeric expression given.
See also ROUND, CEILING / CEIL.
Syntax¶
FLOOR ( expr )
Arguments¶
Parameter |
Description |
---|---|
|
Numeric expression |
Returns¶
Returns the same type as the argument supplied.
When using the FLOOR
floating point number scalar function, real
arguments are automatically cast to double
precision.
Notes¶
If the input value is NULL, the result is NULL.
Examples¶
FLOOR
vs. CEILING / CEIL vs. ROUND¶
numbers=> SELECT FLOOR(x), CEIL(x), ROUND(x)
. FROM (VALUES (0.0001), (-0.0001)
. , (PI()), (-2.718281), (500.1234)) as t(x);
floor | ceil | round
------+------+------
0 | 1 | -0
3 | 4 | 3
-3 | -2 | -3
500 | 501 | 500