1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
<html><head>
<title>cl:rem</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> -
<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>cl:rem</h1>
<hr>
<p><div class="box">
<dl>
<dt>(cl:<b>rem</b> <i>number divisor</i>)</dt>
<dd><i>number</i> - an integer or floating-point number<br>
<i>divisor</i> - an integer or floating-point number<br>
returns - the remainder of a <a href="cl-truncate">cl:truncate</a> operation</dd>
</dl>
</div></p>
<pre class="example">
(defun <font color="#0000CC">cl:rem</font> (number divisor)
(if (= (abs number) (abs divisor))
(if (and (integerp number) (integerp divisor)) 0 0.0)
(let ((quotient (truncate (/ (float number) divisor))))
(- number (* quotient divisor)))))
</pre>
<p>The <nobr>cl:<b>rem</b></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. <nobr>The result</nobr> is either zero or an integer or
<nobr>floating-point</nobr> number with the same sign as the 'number'
argument. <nobr>If both</nobr> arguments are integer numbers, the
<nobr>cl:<b>rem</b></nobr> function is equal to the mathematical remainder
function.</p>
<p><nobr> <a href="#top">Back to top</a></nobr></p>
<hr>
<a href="../../start.htm">Nyquist / XLISP 2.0</a> -
<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>
|