MOD()
Remainder
SMALLINT
, INTEGER
or BIGINT
depending on the type of a.If a is a floating-point type, the result is a BIGINT
.
MOD (a, b)
Parameter | Description |
---|---|
a |
An expression of a numeric type |
b |
An expression of a numeric type |
Returns the remainder of an integer division.
-
Non-integer arguments are rounded before the division takes place.So, “
mod(7.5, 2.5)
” gives 2 (“mod(8, 3)
”), not 0. -
Do not confuse
MOD()
with the mathematical modulus operator;e.g. mathematically,-21 mod 4
is 3, while Firebird’sMOD(-21, 4)
is -1.In other words,MOD()
behaves as%
in languages like C and Java.