TRUNCATE

All functions > MATH > TRUNCATE

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

Signatures

Returns: Integer result after truncation

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

Notes

  • Removes the fractional part, rounding towards zero
  • TRUNCATE(2.9) = 2, TRUNCATE(-2.9) = -2
  • Different from FLOOR for negative numbers
  • TRUNCATE(-2.9) = -2 vs FLOOR(-2.9) = -3
  • Returns NULL if the input is NULL
  • Also known as "truncation" or "chopping"

Examples

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

Last update at: 2026/03/03 16:47:38
Last updated: 2026-03-03 16:48:19