From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.lisp.guile.devel Subject: doco quotient and remainder rounding Date: Thu, 01 May 2003 10:36:11 +1000 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <877k9bcxl0.fsf@zip.com.au> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1051751365 11551 80.91.224.249 (1 May 2003 01:09:25 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 1 May 2003 01:09:25 +0000 (UTC) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu May 01 03:09:23 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19B2Zf-00030A-00 for ; Thu, 01 May 2003 03:09:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19B2WF-0007Yl-02 for guile-devel@m.gmane.org; Wed, 30 Apr 2003 21:05:51 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 19B2Vh-0007PV-00 for guile-devel@gnu.org; Wed, 30 Apr 2003 21:05:17 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 19B2VL-00076i-00 for guile-devel@gnu.org; Wed, 30 Apr 2003 21:04:58 -0400 Original-Received: from snoopy.pacific.net.au ([61.8.0.36]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19B2VH-0006sb-00 for guile-devel@gnu.org; Wed, 30 Apr 2003 21:04:51 -0400 Original-Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.2.228.40]) h4114lI6022464 for ; Thu, 1 May 2003 11:04:48 +1000 Original-Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id h410aj8D002670 for ; Thu, 1 May 2003 10:36:45 +1000 (EST) Original-Received: from localhost (ppp98.dyn228.pacific.net.au [203.143.228.98]) by wisma.pacific.net.au (8.12.9/8.12.9) with ESMTP id h410ahYZ025991 for ; Thu, 1 May 2003 10:36:44 +1000 (EST) Original-Received: from gg by localhost with local (Exim 3.35 #1 (Debian)) id 19B23Y-0000eM-00; Thu, 01 May 2003 10:36:12 +1000 Original-To: guile-devel@gnu.org User-Agent: Gnus/5.090019 (Oort Gnus v0.19) Emacs/21.2 (gnu/linux) X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2243 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2243 --=-=-= 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 --=-=-= Content-Disposition: attachment; filename=scheme-data.texi.division.diff CVS_RSH not defined /usr/bin/cvs -d :pserver:anoncvs@subversions.gnu.org:/cvsroot/guile diff -r1.25 -u scheme-data.texi Index: scheme-data.texi =================================================================== RCS file: /cvsroot/guile/guile/guile-core/doc/ref/scheme-data.texi,v retrieving revision 1.25 diff -u -u -r1.25 scheme-data.texi --- scheme-data.texi 26 Apr 2003 15:30:59 -0000 1.25 +++ scheme-data.texi 1 May 2003 00:32:42 -0000 @@ -554,13 +554,14 @@ @end deffn @c begin (texi-doc-string "guile" "quotient") -@deffn {Scheme Procedure} quotient -Return the quotient of the numbers @var{x} and @var{y}. -@end deffn - @c begin (texi-doc-string "guile" "remainder") -@deffn {Scheme Procedure} remainder -Return the remainder of the numbers @var{x} and @var{y}. +@deffn {Scheme Procedure} quotient n d +@deffnx {Scheme Procedure} remainder n d +Return the quotient or remainder from @var{n} divided by @var{d}. The +quotient is rounded towards zero, and the remainder will have the same +sign as @var{n}. In all cases quotient and remainder satisfy +@math{@var{n} = @var{q}*@var{d} + @var{r}}. + @lisp (remainder 13 4) @result{} 1 (remainder -13 4) @result{} -1 @@ -568,11 +569,15 @@ @end deffn @c begin (texi-doc-string "guile" "modulo") -@deffn {Scheme Procedure} modulo -Return the modulo of the numbers @var{x} and @var{y}. +@deffn {Scheme Procedure} modulo n d +Return the remainder from @var{n} divided by @var{d}, with the same +sign as @var{d}. + @lisp (modulo 13 4) @result{} 1 (modulo -13 4) @result{} 3 +(modulo 13 -4) @result{} -1 +(modulo -13 -4) @result{} -3 @end lisp @end deffn --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel --=-=-=--