In article <3g********************************@4ax.com>, Tim Roberts

<ti**@probo.com> wrote:

Hmmm... "remainder" makes sense. But "%" is mod, right. IIRC from my

abstract algebra days (only 30 yrs ago :-) ) The "X mod n" function

maps onto the postive integers from 0 to n-1. So sounds like numeric

contradicts the math texts. Not good since it's a math module.

That's a bit harsh.

You may be right. I got to work and checked my old Abstract Algebra

book. The defintion is,

We write a=b mod m if m divides (a-b) (i.e. no remeinder).

The defintion does not say how to compute the mod, rather it is an

expression of a relationship between a and b. Hence, writing -2=-7 mod

5 appears to be OK.

The "uniqueness" comes in when we recogize that mod m defines an

equivalence relation on the integers and so for a given m every integer

falls into a unique class (or subset of integers). The set of m

subsets is equivalent to the positive integers 0 to m-1.

So it appears that the translation between math and computer science is

not as clear as I thought. In math (well, number theory) mod is a

relation, not an operation. In computer science it is an operation.

Waddayathink?

--

Lou Pecora

- My views are my own.