Compute modulo function. Conceptually this is given by
x - y .* floor (x ./ y)and is written in a manner that the correct modulus is returned for integer types. This function handles negative values correctly. That is
mod (-1, 3)is 2, not -1 asrem (-1, 3)returns. Also,mod (x, 0)returns x.An error message is printed if the dimensions of the arguments do not agree, or if either of the arguments is complex.