summaryrefslogtreecommitdiff
path: root/docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm
diff options
context:
space:
mode:
Diffstat (limited to 'docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm')
-rw-r--r--docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm93
1 files changed, 93 insertions, 0 deletions
diff --git a/docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm b/docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm
new file mode 100644
index 0000000..b7e89c4
--- /dev/null
+++ b/docsrc/xlisp/xlisp-doc/examples/common-lisp/remainder-and-modulus.htm
@@ -0,0 +1,93 @@
+<html><head>
+
+<title>Remainder and Modulus</title>
+
+<style type="text/css">
+.example {
+ color: #000000;
+ background-color: #F5F5F5;
+ padding: 8px;
+ border: #808080;
+ border-style: solid;
+ border-width: 1px;
+ width:auto;
+}
+.button {
+ color: #000000;
+ background-color: #F5F5F5;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 4px;
+ padding-right: 8px;
+ border: #808080;
+ border-style: solid;
+ border-width: 1px;
+ white-space: pre;
+}
+.box {
+ color: #000000;
+ padding-top: 4px;
+ padding-bottom: 4px;
+ padding-left: 16px;
+ padding-right: 16px;
+ border: #808080;
+ border-style: solid;
+ border-width: 1px;
+}
+</style>
+
+</head>
+
+<body>
+
+<a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
+<a href="../../manual/contents.htm">Contents</a> |
+<a href="../../tutorials/tutorials.htm">Tutorials</a> |
+<a href="../examples.htm">Examples</a> |
+<a href="../../reference/reference-index.htm">Reference</a>
+
+<hr>
+
+<h1>Remainder and Modulus</h1>
+
+<hr>
+
+<p>The <a href="mod.htm">cl:mod</a> and <a href="rem.htm">cl:rem</a>
+function are generalizations of the modulus and remainder functions.</p>
+
+<ul>
+
+<li><p><nobr>The <a href="mod.htm">cl:mod</a></nobr> function performs the
+<a href="floor.htm">cl:floor</a> operation on its arguments and returns the
+remainder of the <a href="floor.htm">cl:floor</a> operation.</p></li>
+
+<li><p><nobr>The <a href="rem.htm">cl:rem</a></nobr> function performs the
+<a href="truncate.htm">cl:truncate</a> operation on its arguments and returns
+the remainder of the <a href="truncate.htm">cl:truncate</a> operation.</p></li>
+
+</ul>
+
+<p><nobr>The <a href="mod.htm">cl:mod</a></nobr> and
+<a href="rem.htm">cl:rem</a> functions are the modulus and remainder
+functions when the 'number' and 'divisor' arguments both are integers.</p>
+
+<pre class="example">
+(mod 13 4) =&gt; 1 (rem 13 4) =&gt; 1
+(mod -13 4) =&gt; 3 (rem -13 4) =&gt; -1
+(mod 13 -4) =&gt; -3 (rem 13 -4) =&gt; 1
+(mod -13 -4) =&gt; -1 (rem -13 -4) =&gt; -1
+(mod 13.4 1) =&gt; 0.4 (rem 13.4 1) =&gt; 0.4
+(mod -13.4 1) =&gt; 0.6 (rem -13.4 1) =&gt; -0.4
+</pre>
+
+<p><nobr>&nbsp;&nbsp;<a href="#top">Back to top</a></nobr></p>
+
+<hr>
+
+<a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
+<a href="../../manual/contents.htm">Contents</a> |
+<a href="../../tutorials/tutorials.htm">Tutorials</a> |
+<a href="../examples.htm">Examples</a> |
+<a href="../../reference/reference-index.htm">Reference</a>
+
+</body></html>