DIVIDE()

All functions > MATH > DIVIDE()

Returns the result of dividing the first number by the second as a double.

Signatures

Numeric division

Returns: Result of the division as a double

DIVIDE(dividend: T, divisor: U) → DOUBLE
sql
ParameterTypeRequiredDescription
dividendTYesNumber to be divided
divisorUYesNumber to divide by

With:

  • T : Any numeric type
  • U : Any numeric type

Signature notes:

  • Both arguments are cast to DOUBLE before division
  • Result is always a DOUBLE, even for integer inputs
  • Returns NULL if either operand is NULL
  • Division by zero raises an error; use TRY_DIVIDE for NULL on divide-by-zero
  • For integer division that preserves the dividend type, use DIVIDE_TYPE

Related operators

Examples

DIVIDE(...)

FeatureQL
SELECT
    -- Function call
    f1 := DIVIDE(10e0, 3e0)
;
Result
f1 VARCHAR
3.3333333333333335

.DIVIDE(...) — chained

FeatureQL
SELECT
    -- Parenthesized DOUBLE base
    f1 := (10e0).DIVIDE(3e0),
    -- DOUBLE literal: chain without extra parentheses
    f2 := 10e0.DIVIDE(3e0)
;
Result
f1 VARCHARf2 VARCHAR
3.33333333333333353.3333333333333335

Edge cases

FeatureQL
SELECT
    -- Exact division
    f1 := DIVIDE(15e0, 5e0),
    -- Half result
    f2 := DIVIDE(7e0, 2e0),
    -- Negative dividend
    f3 := DIVIDE(-8e0, 4e0)
;
Result
f1 VARCHARf2 VARCHARf3 VARCHAR
3.03.5-2.0

Last update at: 2026/06/20 10:08:10