| MATLAB Function Reference | Search  Help Desk |
| rem | See Also |
Syntax
R = rem(X,Y)
Description
R = rem(X,Y)
returns X - fix(X./Y).*Y, where fix(X./Y) is the integer part of the quotient, X./Y.
Remarks
So long as operandsX 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)-yThe
rem function returns a result that is between 0 and sign(X)*abs(Y). If Y is zero, rem returns NaN.
Limitations
ArgumentsX 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
mod