guile-devel
[Top][All Lists]
Advanced

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

doco quotient and remainder rounding


From: Kevin Ryde
Subject: doco quotient and remainder rounding
Date: Thu, 01 May 2003 10:36:11 +1000
User-agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux)

I noticed quotient, remainder and modulo don't actually say how they
round.  The change below is what R5RS specifies, and what guile
already does, if I'm not mistaken.

        * scheme-data.texi (Integer Operations): Describe how quotient,
        remainder, and modulo round their results.

For ease of reading, the new text would be:

 - Scheme Procedure: quotient n d
 - Scheme Procedure: remainder n d
     Return the quotient or remainder from N divided by D.  The
     quotient is rounded towards zero, and the remainder will have the
     same sign as N.  In all cases quotient and remainder satisfy N =
     Q*D + R.

          (remainder 13 4) => 1
          (remainder -13 4) => -1

 - Scheme Procedure: modulo n d
     Return the remainder from N divided by D, with the same sign as D.

          (modulo 13 4) => 1
          (modulo -13 4) => 3
          (modulo 13 -4) => -1
          (modulo -13 -4) => -3

Attachment: scheme-data.texi.division.diff
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]