[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Integer residue-classes [was: Questions about srfi-77 Generic Arithmetic]

This page is part of the web mail archives of SRFI 77 from before July 7th, 2015. The new archives for SRFI 77 contain all messages, not just those from before July 7th, 2015.



Oops!  I wrote:

> ....Another way
> to see that the definitions of div and mod in SRFI 77
> are ad hoc is to observe that
> 
> > (2) if m > 0: 0   <= (x mod m) < m
> >     if m = 0:        (x mod m) = x
> >     if m < 0: m/2 <= (x mod m) < -m/2, and
> 
> could be changed to
> 
>  (2) if m < 0: 0   <= (x mod m) < m
>      if m = 0:        (x mod m) = x
>      if m > 0: m/2 <= (x mod m) < -m/2, and
> 
> while preserving all of the important mathematical properties
> you claimed for div and mod.

That's insane, of course.  I meant it could be changed to

  (2) if m < 0: 0   <= (x mod m) < -m
      if m = 0:        (x mod m) = x
      if m > 0: -m/2 <= (x mod m) < m/2, and

Will