div

a / b on decimals (options scale, mode) or doubles; Int64 / Int64 is refused (use div_trunc, div_floor or a cast).

ScalarDeterministic

Flags

Flag Value
Kind scalar
Nulls a null argument gives null
Deterministic yes
Order matters no
Decomposable no

Example

A pipeline from the language's tested corpus that uses div, over the example tables.

Hint
from orders
derive {per = div(amount, 3, scale: 4, mode: "floor"), r = round(amount, scale: 1, mode: "half_away_from_zero")}

In a plan:

JSON
{
  "args": [
    {
      "col": 2
    },
    {
      "lit": 3,
      "type": {
        "kind": "int64"
      }
    }
  ],
  "fn": "div",
  "options": {
    "mode": "floor",
    "scale": 4
  }
}