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

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.

*To*: sebastian.egner@xxxxxxxxxxx, srfi-77@xxxxxxxxxxxxxxxxx, will@xxxxxxxxxxx*Subject*: Re: Integer residue-classes [was: Questions about srfi-77 Generic Arithmetic]*From*: William D Clinger <will@xxxxxxxxxxx>*Date*: Tue, 21 Feb 2006 11:21:07 -0500*Cc*: lucier@xxxxxxxxxxxxxxx*Delivered-to*: srfi-77@xxxxxxxxxxxxxxxxx

Oops again. I made another mistake, of a more fundamental nature, in my proposed definitions of div, mod, quo, and rem. Here are the corrected definitions: (div q1 q2) ==> nd (mod q1 q2) ==> qm (quo q1 q2) ==> nq (rem q1 q2) ==> qr where: 1. q1 = nd * q2 + qm 2. 0 <= qm < |q2| if q2 <> 0 3. q1 = nq * q2 + qr 4. -|q2/2| <= qr < |q2/2| if q2 <> 0 With this definition, (div 5 3) ==> 1 (div 5 -3) ==> -1 (mod 5 3) ==> 2 (mod 5 -3) ==> 2 (quo 5 3) ==> 2 (quo 5 -3) ==> -2 (rem 5 3) ==> -1 (rem 5 -3) ==> -1 To make these procedures as similar as possible to the div and mod of SRFI 77, let nd=nq=0 and qm=qr=q1 when q2=0. What is interesting about these definitions is that the absolute value signs can themselves be considered ad hoc. Both div and quo are discontinuous in their second argument at 0, and there's no getting around it. Will

**Follow-Ups**:**Re: Integer residue-classes***From:*Michael Sperber

- Prev by Date:
**Re: Integer residue-classes [was: Questions about srfi-77 Generic Arithmetic]** - Next by Date:
**Re: Integer residue-classes [was: Questions about srfi-77 Generic Arithmetic]** - Previous by thread:
**Re: Integer residue-classes [was: Questions about srfi-77 Generic Arithmetic]** - Next by thread:
**Re: Integer residue-classes** - Index(es):