Integer Operations
There are four supported integer datatypes, TINYINT (8 bits),
SMALLINT (16 bits), INTEGER (32 bits), and BIGINT (64
bits).
The legal operations are + (plus, unary and binary), - (minus,
unary and binary), * (multiplication), / (division), %
(modulus).
Modulus involving negative numbers happens as follows:
For: mod = x % y
- if
x >= 0andy > 0then:x - (floor(x / y) * y) - if
x >= 0andy < 0then:x % abs(y) - if
x < 0andy > 0then:- abs(x) % y - if
x < 0andy > 0then:- abs(x) % abs(y)
Example:
| x | y | mod |
|---|---|---|
| 8 | 3 | 2 |
| 8 | -3 | 2 |
| -8 | 3 | -2 |
| -8 | -3 | -2 |
Casting a string to an integer type will produce a runtime error if the string cannot be interpreted as a number.
Division or modulus by zero cause a runtime error.
Operations that cause integer overflow or underflow (example: multiplication or division of minimum integer value by -1) produce run time errors.
Predefined functions on integer values
Operations not supported
Non-deterministic functions, such as RAND are currently not
supported in DBSP.