[R6RS] quotient, remainder, modulo

Michael Sperber sperber at informatik.uni-tuebingen.de
Sun Apr 30 11:06:22 EDT 2006

Excutive summary:

- Extend `quotient' and `remainder' to arbitrary reals and make their
  description consistent with that of `div' and `mod'.

- Ditch `modulo'.

Long version:

If you look in the current revision, you can see that the descriptions
for `div+mod' and `div0+mod0' are consistent in that they say:

(<div op> x1 x2) => nd
(<mod op> x1 x2) => xm
with x1 = nd * x2 + xm

where <div op> is either `div' or `div0', and <mod op> is the
corresponding `mod' or `mod0'.  They only differ in the
characterization of which remainder / representative is chosen.

(If you wonder what the rationale for `div' and `mod' is, check the
thread at


Bring some spare time.)

Now, `quotient+remainder' could be described in the same way.  In
fact, the Scheme code from R5RS reproduced in the SRFI represents the
same equation.  I propose that we do this, thus generalizing
`quotient+remainder' to arbitrary reals, just like `div+mod' and

The way the characterization is written provides the rationale why
`div' is paired with `mod', `div0' is paired with `mod0', and
`quotient' is paired with `remainder'.  However, `modulo' has no dance
partner, and its usefulness is questionable---I've certainly never
seen a case where it was exactly the right thing and none of the
other three was.  As the issue isn't complicated but confusing, I
suggest relegating `modulo' to the R5RS compatibility library and
getting rid of it for the regular R6RS.

Will argued for ditching `quotient' and `remainder' as well (as did
Sebastian Egner):


However, Brad Lucier argues that we should keep `quotient' here:


He also argues for providing a dance partner for `modulo', but no
explicit rationale.

Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

More information about the R6RS mailing list