Debian Codegraph @

docsrc/xlisp/xlisp-doc/examples/common-lisp/log.htm

raw
1 <html><head>
2
3 <title>cl:log</title>
4
5 <style type="text/css">
6 .example {
7 color: #000000;
8 background-color: #F5F5F5;
9 padding: 8px;
10 border: #808080;
11 border-style: solid;
12 border-width: 1px;
13 width:auto;
14 }
15 .button {
16 color: #000000;
17 background-color: #F5F5F5;
18 padding-top: 1px;
19 padding-bottom: 1px;
20 padding-left: 4px;
21 padding-right: 8px;
22 border: #808080;
23 border-style: solid;
24 border-width: 1px;
25 white-space: pre;
26 }
27 .box {
28 color: #000000;
29 padding-top: 4px;
30 padding-bottom: 4px;
31 padding-left: 16px;
32 padding-right: 16px;
33 border: #808080;
34 border-style: solid;
35 border-width: 1px;
36 }
37 </style>
38
39 </head>
40
41 <body>
42
43 <a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
44 <a href="../../manual/contents.htm">Contents</a> |
45 <a href="../../tutorials/tutorials.htm">Tutorials</a> |
46 <a href="../examples.htm">Examples</a> |
47 <a href="../../reference/reference-index.htm">Reference</a>
48
49 <hr>
50
51 <h1>cl:log</h1>
52
53 <hr>
54
55 <p>The <nobr>cl:<b>log</b></nobr> function does the same as the
56 Nyquist/XLISP <a href="../../reference/log.htm">log</a> function, but also
57 accepts integer numbers and has an optional 'base' argument:</p>
58
59 <p><div class="box">
60
61 <dl>
62 <dt>(cl:<b>log</b> <i>number</i> [<i>base</i>])</dt>
63 <dd><i>number</i> - an integer or floating-point number<br>
64 <i>base</i> - an integer or floating-point number<br>
65 returns - the the logarithm of <i>number</i> in base <i>base</i></dd>
66 </dl>
67
68 </div></p>
69
70 <pre class="example">
71 (defun <font color="#0000CC">cl:log</font> (number &amp;optional base)
72 (if base
73 (if (zerop base)
74 0.0
75 (/ (log (float number)) (log (float base))))
76 (log (float number))))
77 </pre>
78
79 <p>The '<nobr>cl:log</nobr>' function returns the logarithm of 'number' in
80 base 'base'. <nobr>If 'base'</nobr> is not supplied its value <nobr>is
81 'e'</nobr>, the base of the natural logarithms. <nobr>If the</nobr> 'base'
82 argument is zero, then 'cl:log' returns zero. <nobr>The result</nobr> is
83 always a <nobr>floating-point</nobr> number.</p>
84
85 <p><nobr>&nbsp;&nbsp;<a href="#top">Back to top</a></nobr></p>
86
87 <hr>
88
89 <a href="../../start.htm">Nyquist / XLISP 2.0</a>&nbsp; -&nbsp;
90 <a href="../../manual/contents.htm">Contents</a> |
91 <a href="../../tutorials/tutorials.htm">Tutorials</a> |
92 <a href="../examples.htm">Examples</a> |
93 <a href="../../reference/reference-index.htm">Reference</a>
94
95 </body></html>