For rem operator, Sign of the result is same as sign of x. The remainder (rem) and modulus (mod) are defined as follows:Previous Next Home
rem(X,Y) = X –(X/Y)*Y (in which X/Y in an integer)
mod(X,Y) = X – Y * N (in which N is an integer)
*Main> rem 10 (-3)
*Main> mod 10 (-3)
For positive integers both mod and rem behave like same.
*Main> rem 10 3
*Main> mod 10 3