DIVIDE
All functions > MATH > DIVIDE
Divides the first number by the second and returns the result as a double.
Syntax
DIVIDE(dividend: T, divisor: T) → DOUBLE sql
Type Parameters:
T: Numeric type: BIGINT, FLOAT, DOUBLE, or DECIMAL (both args same type)
Arguments
| Parameter | Type | Required | Description |
|---|---|---|---|
dividend | T | Yes | Number to be divided |
divisor | T | Yes | Number to divide by |
Returns
DOUBLE - Always returns a double-precision floating point result
Notes
- Both arguments are cast to DOUBLE before division
- Returns NULL if either operand is NULL
- Division by zero results in infinity or error (engine-dependent)
- For integer division that preserves type, use DIVIDE_TYPE
- Operator form:
dividend / divisor - Result is always a floating-point number, even for integer inputs