mod

Definition: atom a3 = mod(atom a1, atom a2)
Description: returns the remainder of two atoms using floored division.
Comments: When the two operands have the same sign this returns the same result as remainder().

When the signs are different this function rounds away from zero whereas remainder rounds towards zero. The result has the same sign as a2 (whereas the result of remainder has the same sign as a1).

This function may be applied to an atom or sq_mod() to all elements of a sequence. The rules for sequence operations apply.
Example:
?mod(-9,-4)         -- -1
?remainder(-9,-4)   -- -1
?mod(-9,4)          -- +3
?remainder(-9,4)    -- -1
?mod(9,-4)          -- -3
?remainder(9,-4)    -- +1
?mod(9,4)           -- +1
?remainder(9,4)     -- +1
See Also: remainder