function z=mymod(x,y);
%MOD    Modulus after division.
%   MYMOD(x,y) is x - n.*y where n = floor(x./y) if y ~= 0.  If y is not an
%   integer and the quotient x./y is within roundoff error of an integer,
%   then n is that integer.  The inputs x and y must be real arrays of the
%   same size, or real scalars.
%
%   The statement "x and y are congruent mod m" means mod(x,m) == mod(y,m).
%
%   By convention:
%      MYMOD(x,0) is x.
%      MYMOD(x,x) is x.
%      MYMOD(x,y), for x~=y and y~=0, has the same sign as y.
%
%   Same as MOD except that MYMOD(x,0) is x instead of 0
if y==x,
  z=x;
else
  z=mod(x,y);
end
