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
    f1 := DIVIDE(10E0, 3E0) -- Function call
;
Result
f1 VARCHAR
3.3333333333333335

.DIVIDE(...) — chained

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

Edge cases

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

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