On Thu, Dec 15, 2005 at 11:51:15PM -0500, Dan Cross wrote:
> On Thu, Dec 15, 2005 at 08:04:02PM -0800, Jack Johnson wrote:
> > So, what *is* -5 MOD 3?
> 
> Well, in general, it depends.
> 
> Do you care whether the result a set or an integer?  The definitions due
> to Wirth et al are the former, while the MS definition appears to be the
> latter.

Hmm, I guess on further reflection I ought to explain what I mean by
this before someone jumps all over me.

The definition as per Wirth et al gives you a positive generator for an
equivalence class on Z, whereas the microsoft definition gives you the
definition of the division function extended to all of Z, which yields
an integer; the former definition is probably more comfortable for a
mathematician, and more what one would expect.  The latter is more
comfortable for someone who just wants to write a program.  In neither
case does this have much to do with the actual implementation (that is
to say, it's not like DIV actually gives you back an object
representing the set of all integers congruent to 0 modulo some integer
in Pascal), but only how that language interprets the definitions.

> Regardless, all these definitions are problematic.  No where does it say
> they're defined only on Z*; what if Y is 0?

This is still a problem.  You really want a function f: Z x Z* -> Z,
not f: Z x Z -> Z; that is, for f(x, y) = x div y, y should be non-zero.
Otherwise, it would be an absurdity.

        - Dan C.

Reply via email to