MATLAB Function Reference
  Go to function:
    Search    Help Desk 
rem    See Also

Remainder after division

Syntax

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 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,

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

mod         Modulus (signed remainder after division)



[ Previous | Help Desk | Next ]