FLOOR
All functions > MATH > FLOOR
Rounds a number down to the nearest integer (floor function).
Signatures
Returns: Integer result of rounding down
FLOOR(number: T) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
number | T | Yes | The number to round down |
Notes
- Always rounds towards negative infinity
FLOOR(2.1) = 2,FLOOR(2.9) = 2FLOOR(-2.1) = -3,FLOOR(-2.9) = -3- Returns NULL if the input is NULL
- For exact integers, returns the same value
- Opposite behavior of CEIL function
Examples
FeatureQL
SELECT
f1 := FLOOR(2.1e0), -- Positive decimal rounds down
f2 := FLOOR(2.9e0), -- Another positive decimal
f3 := FLOOR(-2.1e0), -- Negative rounds away from zero
f4 := FLOOR(-2.9e0), -- Negative closer to integer
f5 := FLOOR(5.0e0), -- Exact integer unchanged
f6 := FLOOR(0.0e0), -- Zero unchanged
f7 := FLOOR(3.14159e0), -- Pi rounds down to 3
f8 := FLOOR(-3.14159e0), -- Negative pi rounds to -4
f9 := FLOOR(2.4e0), -- From tests
f10 := FLOOR(-2.4e0) -- Negative from tests
;Result
| f1 BIGINT | f2 BIGINT | f3 BIGINT | f4 BIGINT | f5 BIGINT | f6 BIGINT | f7 BIGINT | f8 BIGINT | f9 BIGINT | f10 BIGINT |
|---|---|---|---|---|---|---|---|---|---|
| 2 | 2 | -3 | -3 | 5 | 0 | 3 | -4 | 2 | -3 |
On this page