FLOOR()

All functions > MATH > FLOOR()

Returns the largest integer less than or equal to the input.

Signatures

Floor

Returns: Largest integer ≤ input

FLOOR(number: T) → BIGINT
sql
ParameterTypeRequiredDescription
numberTYesThe number to round down

With:

  • T : Custom types: FLOAT | DOUBLE | DECIMAL

Signature notes:

  • Always rounds toward negative infinity
  • Returns NULL if the input is NULL
  • Opposite of CEIL for negative numbers

Examples

FeatureQL
SELECT
    -- Positive rounds down
    f1 := FLOOR(2.1e0),
    -- Another positive
    f2 := FLOOR(2.9e0),
    -- Negative rounds away from zero
    f3 := FLOOR(-2.1e0),
    -- Negative further from zero
    f4 := FLOOR(-2.9e0),
    -- Exact integer unchanged
    f5 := FLOOR(5.0e0),
    -- Pi rounds down to 3
    f6 := FLOOR(3.14159e0)
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINTf5 BIGINTf6 BIGINT
22-3-353