Thursday, August 10, 2006

what is modular arithmetic

for any integer a and any positive integer n,the value a mod n is the the remainder(or residue) of quotient a/n, that is:
a mod n = a - floor(a/n)*n;
but,we've met a problem when we manipulate scilab's function modular,where a or n may be negative.
we can find that we get different answers between modular and remainder, so the definition metioned above isn't precisely correct if without the restriction that n is positive integer.

0 Comments:

Post a Comment

<< Home