summaryrefslogtreecommitdiff
path: root/docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm
diff options
context:
space:
mode:
Diffstat (limited to 'docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm')
-rw-r--r--docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm105
1 files changed, 105 insertions, 0 deletions
diff --git a/docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm b/docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm
new file mode 100644
index 0000000..05e95ea
--- /dev/null
+++ b/docsrc/xlisp/xlisp-doc/examples/common-lisp/expt.htm
@@ -0,0 +1,105 @@
+<html><head>
+
+<title>cl:expt</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>cl:expt</h1>
+
+<hr>
+
+<p>The <nobr>cl:<b>expt</b></nobr> function computes the result of 'x' to
+the power <nobr>of 'y'</nobr>:</p>
+
+<p><div class="box">
+
+<dl>
+<dt>(cl:<b>expt</b> <i>base power</i>)</dt>
+<dd><i>base</i> - the base<br>
+<i>power</i> - the exponent<br>
+returns - the result of <i>base</i> to the power of <i>power</i></dd>
+</dl>
+
+</div></p>
+
+<pre class="example">
+(defun <font color="#0000CC">cl:expt</font> (x y)
+ (let ((power (expt (float x) y)))
+ (if (and (integerp x) (integerp y))
+ (round power)
+ power)))
+</pre>
+
+<p>See <a href="../reference/and.htm">and</a>,
+<a href="../reference/defun.htm">defun</a>,
+<a href="../reference/expt.htm">expt</a>,
+<a href="../reference/float.htm">float</a>,
+<nobr><a href="../reference/if.htm">&nbsp;if&nbsp;</a></nobr>,
+<a href="../reference/integerp.htm">integerp</a>,
+<a href="../reference/let.htm">let</a>,
+<a href="../reference/power.htm">power</a>,
+<a href="../reference/round.htm">round</a>.</p>
+
+<p>The <nobr>cl:<b>expt</b></nobr> function accepts integer and floating
+point numbers as arguments. <nobr>If both</nobr> arguments are integer
+numbers, the result will be an integer number, <nobr>if one</nobr> or both
+arguments are <nobr>floating-point</nobr> numbers, the result will be a
+<nobr>floating-point</nobr> number. <nobr>In contrast</nobr> to the
+Nyquist/XLISP <a href="../../reference/expt.htm">expt</a> function, the
+'<nobr>cl:expt</nobr>' function accepts exactly two arguments.</p>
+
+<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>