[SciPy-user] Matlab function rem in scipy ??

Nils Wagner nwagner at mecha.uni-stuttgart.de
Tue Apr 6 07:14:40 EDT 2004


Dear experts,

R = rem(X,Y) if Y ~= 0, returns X - n.*Y where n = fix(X./Y). If Y is
not an integer and the quotient X./Y is within roundoff error of an
integer, then n is that integer. By convention, rem(X,0) is NaN. The
inputs X and Y must be real arrays of the same size, or real scalars.
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.

Is there any comparable function in scipy ?

Nils




More information about the SciPy-User mailing list