TRUNCATE()

All functions > MATH > TRUNCATE()

Returns the integer part of a number by discarding the fractional part.

Signatures

Truncate

Returns: Integer result after truncation

TRUNCATE(number: T) → BIGINT
sql
ParameterTypeRequiredDescription
numberTYesThe number to truncate

With:

  • T : Custom types: FLOAT | DOUBLE | DECIMAL

Signature notes:

  • Rounds toward zero (discards fractional part)
  • Different from FLOOR for negative numbers: TRUNCATE(-2.9) = -2 vs FLOOR(-2.9) = -3
  • Returns NULL if the input is NULL

Examples

FeatureQL
SELECT
    f1 := TRUNCATE(2.1E0), -- Positive truncates toward zero
    f2 := TRUNCATE(2.9E0), -- Removes decimal part
    f3 := TRUNCATE(-2.1E0), -- Negative truncates toward zero
    f4 := TRUNCATE(-2.9E0), -- Different from FLOOR
    f5 := TRUNCATE(3.14159E0) -- Pi truncated
;
Result
f1 BIGINTf2 BIGINTf3 BIGINTf4 BIGINTf5 BIGINT
22-2-23

Last update at: 2026/05/26 17:22:09