summaryrefslogtreecommitdiffstats
path: root/modular.txi
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2005-01-10 08:53:33 +0000
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:30 -0800
commite33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e (patch)
treeabbf06041619e445f9d0b772b0d58132009d8234 /modular.txi
parentf559c149c83da84d0b1c285f0298c84aec564af9 (diff)
parent8466d8cfa486fb30d1755c4261b781135083787b (diff)
downloadslib-e33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e.tar.gz
slib-e33f9eb9cf5cc29c36ce2aa7e10cd0f37ae0cc8e.zip
Import Debian changes 3a1-4.2debian/3a1-4.2
slib (3a1-4.2) unstable; urgency=low * Non-maintainer upload. * Add guile.init.local for use within the build dir, since otherwise we have an (earlier unnoticed) circular build-dep due to a difference between scm and guile. slib (3a1-4.1) unstable; urgency=low * Non-maintainer upload. * Build-depend on guile-1.6 instead of scm, since the new version of scm is wedged in unstable (closes: #281809). slib (3a1-4) unstable; urgency=low * Also check for expected creation on slibcat. (Closes: #240096) slib (3a1-3) unstable; urgency=low * Also check for /usr/share/guile/1.6/slib before installing for guile 1.6. (Closes: #239267) slib (3a1-2) unstable; urgency=low * Add format.scm back into slib until gnucash stops using it. * Call guile-1.6 new-catalog (Closes: #238231) slib (3a1-1) unstable; urgency=low * New upstream release * Remove Info section from doc-base file (Closes: #186950) * Remove period from end of description (linda, lintian) * html gen fixed upstream (Closes: #111778) slib (2d4-2) unstable; urgency=low * Fix url for upstream source (Closes: #144981) * Fix typo in slib.texi (enquque->enqueue) (Closes: #147475) * Add build depends. slib (2d4-1) unstable; urgency=low * New upstream. slib (2d3-1) unstable; urgency=low * New upstream. * Remove texi2html call in debian/rules. Now done upstream. Add make html instead. * Changes to rules and doc-base to conform to upstream html gen * Clean up upstream makefile to make sure it cleans up after itself.
Diffstat (limited to 'modular.txi')
-rw-r--r--modular.txi114
1 files changed, 114 insertions, 0 deletions
diff --git a/modular.txi b/modular.txi
new file mode 100644
index 0000000..d947b35
--- /dev/null
+++ b/modular.txi
@@ -0,0 +1,114 @@
+@code{(require 'modular)}
+@ftindex modular
+
+
+@defun mod x1 x2
+@defunx rem x1 x2
+
+These procedures implement the Common-Lisp functions of the same names.
+The real number @var{x2} must be non-zero.
+@code{mod} returns @code{(- @var{x1} (* @var{x2} (floor (/ @var{x1} @var{x2}))))}.
+@code{rem} returns @code{(- @var{x1} (* @var{x2} (truncate (/ @var{x1} @var{x2}))))}.
+
+If @var{x1} and @var{x2} are integers, then @code{mod} behaves like
+@code{modulo} and @code{rem} behaves like @code{remainder}.
+
+@format
+@t{(mod -90 360) @result{} 270
+(rem -90 180) @result{} -90
+
+(mod 540 360) @result{} 180
+(rem 540 360) @result{} 180
+
+(mod (* 5/2 pi) (* 2 pi)) @result{} 1.5707963267948965
+(rem (* -5/2 pi) (* 2 pi)) @result{} -1.5707963267948965
+}
+@end format
+@end defun
+
+@defun extended-euclid n1 n2
+
+Returns a list of 3 integers @code{(d x y)} such that d = gcd(@var{n1},
+@var{n2}) = @var{n1} * x + @var{n2} * y.
+@end defun
+
+@defun symmetric:modulus n
+
+Returns @code{(quotient (+ -1 n) -2)} for positive odd integer @var{n}.
+@end defun
+
+@defun modulus->integer modulus
+
+Returns the non-negative integer characteristic of the ring formed when
+@var{modulus} is used with @code{modular:} procedures.
+@end defun
+
+@defun modular:normalize modulus n
+
+Returns the integer @code{(modulo @var{n} (modulus->integer
+@var{modulus}))} in the representation specified by @var{modulus}.
+@end defun
+@noindent
+The rest of these functions assume normalized arguments; That is, the
+arguments are constrained by the following table:
+
+@noindent
+For all of these functions, if the first argument (@var{modulus}) is:
+@table @code
+@item positive?
+Work as before. The result is between 0 and @var{modulus}.
+
+@item zero?
+The arguments are treated as integers. An integer is returned.
+
+@item negative?
+The arguments and result are treated as members of the integers modulo
+@code{(+ 1 (* -2 @var{modulus}))}, but with @dfn{symmetric}
+@cindex symmetric
+representation; i.e. @code{(<= (- @var{modulus}) @var{n}
+@var{modulus})}.
+@end table
+
+@noindent
+If all the arguments are fixnums the computation will use only fixnums.
+
+
+@defun modular:invertable? modulus k
+
+Returns @code{#t} if there exists an integer n such that @var{k} * n
+@equiv{} 1 mod @var{modulus}, and @code{#f} otherwise.
+@end defun
+
+@defun modular:invert modulus n2
+
+Returns an integer n such that 1 = (n * @var{n2}) mod @var{modulus}. If
+@var{n2} has no inverse mod @var{modulus} an error is signaled.
+@end defun
+
+@defun modular:negate modulus n2
+
+Returns (@minus{}@var{n2}) mod @var{modulus}.
+@end defun
+
+@defun modular:+ modulus n2 n3
+
+Returns (@var{n2} + @var{n3}) mod @var{modulus}.
+@end defun
+
+@defun modular:- modulus n2 n3
+
+Returns (@var{n2} @minus{} @var{n3}) mod @var{modulus}.
+@end defun
+
+@defun modular:* modulus n2 n3
+
+Returns (@var{n2} * @var{n3}) mod @var{modulus}.
+
+The Scheme code for @code{modular:*} with negative @var{modulus} is
+not completed for fixnum-only implementations.
+@end defun
+
+@defun modular:expt modulus n2 n3
+
+Returns (@var{n2} ^ @var{n3}) mod @var{modulus}.
+@end defun