Returns the remainder resulting from dividing
$arg1, the dividend, by
$arg2, the divisor.
General rules: see .
a mod b for operands that are
xs:decimal, or types derived from them, produces a result such that
(a idiv b)*b+(a mod b) is equal to
a and the magnitude of
the result is always less than the magnitude of
b. This identity holds even
in the special case that the dividend is the negative integer of largest possible
magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this
rule that the sign of the result is the sign of the dividend.
xs:double operands the following rules
If either operand is
NaN, the result is
If the dividend is positive or negative infinity, or the divisor is positive or
negative zero (0), or both, the result is
If the dividend is finite and the divisor is an infinity, the result equals the dividend.
If the dividend is positive or negative zero and the divisor is finite, the result is the same as the dividend.
In the remaining cases, where neither positive or negative infinity, nor positive
or negative zero, nor
NaN is involved, the result obeys
b)*b+(a mod b) =
Division is truncating division, analogous to integer division, not rounding division i.e. additional digits are truncated,
not rounded to the required precision.
op:numeric-mod(1.23E2, 0.6E1) returns
A dynamic error is raised for
xs:decimal operands, if
$arg2 is zero.