/ [division]

All functions > MATH > / [division]

Divides the left-hand number by the right-hand number, producing a DOUBLE result.

Syntax

left / right  ·  DIVIDE(left, right)

Function form

Numeric division: 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

  • 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

Notes

  • Both operands are promoted for division; the result type is DOUBLE
  • Returns NULL if either operand is NULL
  • Division by zero is an error; use TRY DIVIDE for a NULL result when the divisor may be zero
  • For type-preserving division (including integer truncation), use DIVIDE_TYPE (//)

Examples

/ — floating-point division

FeatureQL
RETURN
    -- Quotient as DOUBLE
    f1 := 10e0 / 3e0,
    -- Exact division
    f2 := 15e0 / 5e0
;
Result
f1 DECIMALf2 DECIMAL
3.33333333333333353.0

/ — edge cases

FeatureQL
RETURN
    -- Negative dividend
    f1 := -8e0 / 4e0
;
Result
f1 DECIMAL
-2.0

DIVIDE(...)

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

.DIVIDE(...) — chained

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

DIVIDE — Edge cases

FeatureQL
RETURN
    -- Exact division
    f1 := DIVIDE(15e0, 5e0),
    -- Half result
    f2 := DIVIDE(7e0, 2e0),
    -- Negative dividend
    f3 := DIVIDE(-8e0, 4e0)
;
Result
f1 DECIMALf2 DECIMALf3 DECIMAL
3.03.5-2.0