* doco quotient and remainder rounding
@ 2003-05-01 0:36 Kevin Ryde
2003-05-01 15:52 ` Paul Jarc
0 siblings, 1 reply; 3+ messages in thread
From: Kevin Ryde @ 2003-05-01 0:36 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 908 bytes --]
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 #2: scheme-data.texi.division.diff --]
[-- Type: text/plain, Size: 1622 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: doco quotient and remainder rounding
2003-05-01 0:36 doco quotient and remainder rounding Kevin Ryde
@ 2003-05-01 15:52 ` Paul Jarc
2003-05-03 22:43 ` Kevin Ryde
0 siblings, 1 reply; 3+ messages in thread
From: Paul Jarc @ 2003-05-01 15:52 UTC (permalink / raw)
Cc: guile-devel
Kevin Ryde <user42@zip.com.au> wrote:
> (modulo 13 -4) => -1
> (modulo -13 -4) => -3
guile> (modulo 13 -4)
-3
guile> (modulo -13 -4)
-1
paul
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: doco quotient and remainder rounding
2003-05-01 15:52 ` Paul Jarc
@ 2003-05-03 22:43 ` Kevin Ryde
0 siblings, 0 replies; 3+ messages in thread
From: Kevin Ryde @ 2003-05-03 22:43 UTC (permalink / raw)
prj@po.cwru.edu (Paul Jarc) writes:
>
> guile> (modulo 13 -4)
> -3
> guile> (modulo -13 -4)
> -1
Oops, thanks.
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-05-03 22:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-01 0:36 doco quotient and remainder rounding Kevin Ryde
2003-05-01 15:52 ` Paul Jarc
2003-05-03 22:43 ` Kevin Ryde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).