Operators
Operator
//
Use the // operator for integer division. With integer operands, the fractional part is discarded rather than returned as a decimal.
Reference: Haybarn WASM 2.0.0-rc12
Operands & returns
12 overloadsleft // right
Operator
| Overload link | left | right |
Returns |
|---|---|---|---|
| #01 | BIGINT | BIGINT |
BIGINT |
| #02 | DOUBLE | DOUBLE |
DOUBLE |
| #03 | FLOAT | FLOAT |
FLOAT |
| #04 | HUGEINT | HUGEINT |
HUGEINT |
| #05 | INTEGER | INTEGER |
INTEGER |
| #06 | SMALLINT | SMALLINT |
SMALLINT |
| #07 | TINYINT | TINYINT |
TINYINT |
| #08 | UBIGINT | UBIGINT |
UBIGINT |
| #09 | UHUGEINT | UHUGEINT |
UHUGEINT |
| #10 | UINTEGER | UINTEGER |
UINTEGER |
| #11 | USMALLINT | USMALLINT |
USMALLINT |
| #12 | UTINYINT | UTINYINT |
UTINYINT |
Divide integers without a fractional result
Use the // operator for integer division. With integer operands, the fractional part is discarded rather than returned as a decimal.
For integer operands, truncation is toward zero. A NULL operand yields NULL.
Haybarn WASM 2.0.0-rc12 ยท In your browser
Guide example ยท Run to view results.
| quotient | negative_quotient | missing |
|---|---|---|
3 | -3 | NULL |
Watch for: The / operator performs floating point division on integer inputs. Choose // only when discarding the remainder is intended.