| MATLAB Function Reference | ![]() |
Syntax
R = rem(X,Y)
Description
returns R = rem(X,Y)
X - fix(X./Y).*Y, where fix(X./Y) is the integer part of the quotient, X./Y.
Remarks
So long as operands X and Y are of the same sign, the statement rem(X,Y) returns the same result as does mod(X,Y). However, for positive X and Y,
rem(-x,y) = mod(-x,y)-y
The rem function returns a result that is between 0 and sign(X)*abs(Y). If Y is zero, rem returns NaN.
Limitations
Arguments X and Y should be integers. Due to the inexact representation of floating-point numbers on a computer, real (or complex) inputs may lead to unexpected results.
See Also
| rehash | repmat | ![]() |