re-formatting around lambda lists
[clqr.git] / clqr-numbers.tex
blobb320411f3010dab7185a95f489349e940572d23b
1 % Copyright (C) 2008 Bert Burgemeister
3 % Permission is granted to copy, distribute and/or modify this
4 % document under the terms of the GNU Free Documentation License,
5 % Version 1.2 or any later version published by the Free Software
6 % Foundation; with no Invariant Sections, no Front-Cover Texts and
7 % no Back-Cover Texts. For details see file COPYING.
10 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 \section{Numbers}
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 \subsection{Predicates}
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 \begin{LIST}{1cm}
20 \IT{\arrGOO{(\FU{\boldmath$=$}\RP{\VAR{
21 number}})\\
22 (\FU{\boldmath$/=$}\RP{\VAR{ number}})}{.}}
24 \index{=}%
25 \index{/=}%
26 Return \retval{\T} if all \VAR{number}s, or
27 none, respectively, are equal.
30 \IT{\arrGOO{(\FU{\boldmath$>$}\RP{\VAR{
31 number}})\\(\FU{\boldmath$>=$}\RP{\VAR{
32 number}})\\(\FU{\boldmath$<$}\RP{\VAR{
33 number}})\\(\FU{\boldmath$<=$}\RP{\VAR{ number}})}{.}}
35 \index{>@$>$}%
36 \index{>=@$>=$}%
37 \index{<@$<$}%
38 \index{<=@$<=$}%
39 Return \retval{\T} if \VAR{number}s are
40 monotonically decreasing, monotonically non-increasing,
41 monotonically increasing, or monotonically non-decreasing, respectively.
44 \IT{\arrGOO{(\FU*{MINUSP} \VAR{ a})\\
45 (\FU*{ZEROP} \VAR{ a})\\
46 (\FU*{PLUSP}
47 \VAR{ a})}{.}}
49 Return \retval{\T} if $a < 0$, $a = 0$, or $a > 0$, respectively.
52 \IT{\arrGOO{(\FU*{EVENP } \VAR{integer})\\
53 (\FU*{ODDP } \VAR{integer})}{.}}
55 Return \retval{\T} if \VAR{integer} is even or odd, respectively.
58 \IT{\arrGOO{(\FU*{NUMBERP} \VAR{ foo})\\
59 (\FU*{INTEGERP} \VAR{ foo})\\
60 (\FU*{RATIONALP} \VAR{ foo})\\
61 (\FU*{FLOATP} \VAR{ foo})\\
62 (\FU*{REALP} \VAR{ foo})\\
63 (\FU*{COMPLEXP} \VAR{ foo})\\
64 (\FU*{RANDOM-STATE-P} \VAR{ foo})
65 }{.}}
67 \retval{\T} if \VAR{foo} is of
68 indicated type.
71 \IT{(\FU*{LOGBITP} \VAR{i} \VAR{integer})}
73 \retval{\T} if zero-indexed \VAR{i}th bit of \VAR{integer} is set.
77 \end{LIST}
79 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
80 \subsection[Numeric~Functns]{Numeric Functions}
81 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 \begin{LIST}{1cm}
85 \IT{(\FU*{ABS} \VAR{n})}
87 Return \retval{$|n|$}
90 \IT{\arrGOO{(\FU*{+} \OPn{\VAR{ a}})\\
91 (\FU*{*} \OPn{\VAR{ a}})}{.}}
93 Return \retval{$\sum{a}$} or \retval{$\prod{a}$}, respectively. Without any
94 \VAR{a}s, return \retval{0} or \retval{1}, respectively.
97 \IT{\arrGOO{(\FU*{--} \VAR{ a}\OPn{\VAR{ b}})\\
98 (\FU*{/} \VAR{ a}
99 \OPn{\VAR{ b}})}{.}}
101 Return \retval{$a-\sum{b}$} or \retval{$a/\prod{b}$}, respectively. Without any
102 \VAR{b}s, return \retval{$-a$} or \retval{$1/a$}, respectively.
105 \IT{\arrGOO{(\FU*{1+} \VAR{ a})\\(\FU*{1--} \VAR{ a})}{.}}
106 {Return \retval{$a+1$} or
107 \retval{$a-1$}, respectively.
110 \IT{(\xorGOO{\MC*{INCF}\\
111 \MC*{DECF}}{\}} \DES{\VAR{place}}
112 \Op{\VAR{delta}\DF{\LIT{1}}})}
114 Increment or
115 decrement \VAR{place} by \VAR{delta} returning \retval{new value}.
118 \IT{(\FU*{EXP} \VAR{p})}
119 {Return \retval{$\mbox{e}^p$}.
122 \IT{(\FU*{EXPT} \VAR{b} \VAR{p})}
123 {Return \retval{$b^p$}.
126 \IT{(\FU*{LOG} \VAR{a} \Op{\VAR{b}})}
128 Return \retval{$\log_b a$} or,
129 without \VAR{b}, \retval{$\ln a$}.
132 \IT{\arrGOO{(\FU*{SQRT} \VAR{ n})\\
133 (\FU*{ISQRT} \VAR{ n})}{.}}
135 \retval{$\sqrt{n}$} in complex or natural numbers, respectively.
138 \IT{\arrGOO{(\FU*{LCM} \OPn{\VAR{ integer}}\DF{\LIT{1}})\\
139 (\FU*{GCD} \OPn{\VAR{ integer}})}{.}}
141 \retval{Least common multiple} or \retval{greatest common
142 de\-no\-mi\-na\-tor}, respectively, of \VAR{integer}s.
145 \IT{\CNS*{PI}}
147 \kwd{long-float} approximation of $\pi$, Ludolph's number.
150 \IT{\arrGOO{(\FU*{SIN} \VAR{ a})\\
151 (\FU*{COS} \VAR{ a})\\
152 (\FU*{TAN} \VAR{ a})}{.}}
154 With \VAR{a} in radians, return \retval{$\sin a$}, \retval{$\cos
155 a$}, or \retval{$\tan a$}, respectively.
158 \IT{\arrGOO{(\FU*{ASIN} \VAR{ a})\\
159 (\FU*{ACOS} \VAR{ a})}{.}}
161 \retval{$\arcsin a$} or \retval{$\arccos
162 a$}, respectively, in radians.
165 \IT{(\FU*{ATAN} \VAR{a} \Op{\VAR{b}\DF{\LIT{1}}})}
167 \retval{$\arctan \frac{a}{b}$} in radians.
170 \IT{\arrGOO{(\FU*{SINH} \VAR{ a})\\(\FU*{COSH} \VAR{ a})\\(\FU*{TANH}
171 \VAR{ a})}{.}}
173 Return \retval{$\sinh a$}, \retval{$\cosh
174 a$}, or \retval{$\tanh a$}, respectively.
177 \IT{\arrGOO{(\FU*{ASINH} \VAR{ a})\\
178 (\FU*{ACOSH} \VAR{ a})
179 \\(\FU*{ATANH} \VAR{ a})}{.}}
181 \retval{$\operatorname{asinh} a$}, \retval{$\operatorname{acosh}
182 a$}, or \retval{$\operatorname{atanh} a$}, respectively.
185 \IT{(\FU*{CIS} \VAR{a})}
187 Return
188 \retval{$\operatorname{e}^{\operatorname{i} a} = \cos a +
189 \operatorname{i}\sin a$}.
192 \IT{(\FU*{CONJUGATE} \VAR{a})}
193 {Return \retval{conjugate of \VAR{a}}.
196 \IT{\arrGOO{(\FU*{NUMERATOR} \VAR{ rational})\\
197 (\FU*{DENOMINATOR} \VAR{ rational})}{.}}
199 \retval{Numerator} or \retval{denominator}, respectively, of
200 \VAR{rational}'s canonical form.
203 \IT{\arrGOO{(\FU*{REALPART} \VAR{ number})\\
204 (\FU*{IMAGPART} \VAR{ number})}{.}}
206 Return \retval{real part} or \retval{imaginary part}, respectively, of \VAR{number}.
209 \IT{\arrGOO{(\FU*{MAX } \RP{\VAR{num}})\\
210 (\FU*{MIN } \RP{\VAR{num}})}{.}}
212 Return \retval{greatest} or \retval{least}, respectively, of \VAR{num}s.
215 \IT{(\xorGOO{%
216 \Goo{\FU*{FLOOR}\XOR\FU*{FFLOOR}}\\
217 \Goo{\FU*{CEILING}\XOR\FU*{FCEILING}}\\
218 \Goo{\FU*{TRUNCATE}\XOR\FU*{FTRUNCATE}}\\
219 \Goo{\FU*{ROUND}\XOR\FU*{FROUND}}}{\}}
220 \VAR{n} \Op{\VAR{d}\DF{\LIT{1}}})}
222 Return \retval{$n/d$} (\kwd{integer} or \kwd{float}, respectively) truncated
223 towards $-\infty$, $+\infty$, $0$, or rounded, respectively; and \retvalii{re\-main\-der}.
226 \IT{(\xorGOO{\FU*{MOD}\\
227 \FU*{REM}}{\}} \VAR{n} \Op{\VAR{d}\DF{\LIT{1}}})}
228 {Same as \FU{floor} or
229 \FU{truncate}, respectively, but return \retval{re\-main\-der} only.
232 \IT{(\FU*{RANDOM} \VAR{limit} \Op{\VAR{state}\DF{\V{*random-state}}})}
234 Return non-negative \retval{random
235 number} less then, and of type of \VAR{limit}.
238 \IT{(\FU*{MAKE-RANDOM-STATE} \Op{\VAR{state}\DF{\NIL}})}
240 Make \retval{random state}.
243 \IT{\V*{*random-state*}}
245 Current random state.
248 \IT{(\FU*{FLOAT-SIGN} \VAR{num-a} \Op{\VAR{num-b}\DF{\LIT{1}}})}
250 \retval{\VAR{num-b}} with the sign of \VAR{num-a}.
253 \IT{(\FU*{SIGNUM} \VAR{n})}
254 {\retval{Number} of magnitude 1
255 representing sign or phase of \VAR{n}.
258 \IT{(\FU*{COMPLEX} \VAR{real} \Op{\VAR{imag}\DF{\LIT{0}}})}
259 {Make a \retval{complex number}.
262 \IT{(\FU*{PHASE} \VAR{number})}
263 {\retval{Angle} of \VAR{number}'s polar representation.
266 \IT{\arrGOO{(\FU*{RATIONAL} \VAR{ real})\\
267 (\FU*{RATIONALIZE} \VAR{ real})}{.}}
269 Convert \VAR{real} to \retval{rational}. Assume complete/limited accuracy for \VAR{real}.
272 \IT{(\FU*{FLOAT} \VAR{real}
273 \Op{\VAR{prototype}\DF{\kwd{single-float}}})}
275 Convert \VAR{real} into \VAR{prototype}-shaped \retval{float}.
278 \end{LIST}
281 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 \subsection{Logic Functions}
283 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
284 \label{section:Logic Functions}
286 \begin{LIST}{1cm}
288 \IT{(\FU*{BOOLE} \VAR{operation} \VAR{int-a} \VAR{int-b})}
290 Return
291 \retval{value} of bit-wise logical \VAR{operation}. \VAR{operation}s
295 \begin{LIST}{.5cm}
296 \IT{\CNS*{BOOLE-1}} {\retval{\VAR{int-a}}.}
297 \IT{\CNS*{BOOLE-2}} {\retval{\VAR{int-b}}.}
298 \IT{\CNS*{BOOLE-C1}} {\retval{Two's complement of \VAR{int-a}}.}
299 \IT{\CNS*{BOOLE-C2}} {\retval{Two's complement of \VAR{int-b}}.}
300 \IT{\CNS*{BOOLE-SET}} {\retval{All bits set}.}
301 \IT{\CNS*{BOOLE-CLR}} {\retval{All bits zero}.}
302 \IT{\CNS*{BOOLE-EQV}} {\retval{$\text{\VAR{int-a}} \equiv \text{\VAR{int-b}}$}.}
303 \IT{\CNS*{BOOLE-AND}} {\retval{$\text{\VAR{int-a}}\land\text{\VAR{int-b}}$}.}
304 \IT{\CNS*{BOOLE-ANDC1}} {\retval{Two's complement of \VAR{int-a} $\land$ \VAR{int-b}}.}
305 \IT{\CNS*{BOOLE-ANDC2}} {\retval{\VAR{int-a} $\land$ two's complement of \VAR{int-b}}.}
306 \IT{\CNS*{BOOLE-NAND}} {\retval{$\lnot(\text{\VAR{int-a}} \land \text{\VAR{int-b}})$}.}
307 \IT{\CNS*{BOOLE-IOR}} {\retval{$\text{\VAR{int-a}} \lor \text{\VAR{int-b}}$}.}
308 \IT{\CNS*{BOOLE-ORC1}} {\retval{Two's complement of \VAR{int-a} $\lor$ \VAR{int-b}}.}
309 \IT{\CNS*{BOOLE-ORC2}} {\retval{\VAR{int-a} $\lor$ two's complement of \VAR{int-b}}.}
310 \IT{\CNS*{BOOLE-XOR}} {\retval{$\lnot(\text{\VAR{int-a}} \equiv \text{\VAR{int-b}})$}.}
311 \IT{\CNS*{BOOLE-NOR}} {\retval{$\lnot(\text{\VAR{int-a}} \lor \text{\VAR{int-b}})$}.}
312 \end{LIST}
314 \IT{(\FU*{LOGNOT}\VAR{ integer})}
316 \retval{Two's complement of \VAR{integer}}.
319 \IT{\arrGOO{(\FU*{LOGEQV} \OPn{\VAR{ integer}})\\
320 (\FU*{LOGAND} \OPn{\VAR{ integer}})}{.}}
322 Return \retval{value of exclusive-nored or anded \VAR{integer}s},
323 respectively. Without any \VAR{integer}, return \retval{$-1$}.
326 \IT{(\FU*{LOGANDC1} \VAR{ int-a} \VAR{ int-b})}
328 \retval{Two's complement of \VAR{int-a} $\land$ \VAR{int-b}}.
331 \IT{(\FU*{LOGANDC2} \VAR{ int-a} \VAR{ int-b})}
333 \retval{\VAR{int-a} $\land$ two's complement of \VAR{int-b}}.
336 \IT{(\FU*{LOGNAND} \VAR{ int-a} \VAR{ int-b})}
338 \retval{$\lnot(\text{\VAR{int-a}} \land \text{\VAR{int-b}})$}.
341 \IT{\arrGOO{(\FU*{LOGXOR} \OPn{\VAR{ integer}})\\
342 (\FU*{LOGIOR} \OPn{\VAR{ integer}})}{.}}
344 Return \retval{value of exclusive-ored or ored \VAR{integer}s},
345 respectively. Without any \VAR{integer}, return \retval{0}.
348 \IT{(\FU*{LOGORC1} \VAR{ int-a} \VAR{ int-b})}
350 \retval{Two's complement of \VAR{int-a} $\lor$ \VAR{int-b}}.
353 \IT{(\FU*{LOGORC2} \VAR{ int-a} \VAR{ int-b})}
355 \retval{\VAR{int-a} $\lor$ two's complement of \VAR{int-b}}.
358 \IT{(\FU*{LOGNOR} \VAR{ int-a} \VAR{ int-b})}
360 \retval{$\lnot(\text{\VAR{int-a}} \lor \text{\VAR{int-b}})$}.
363 \IT{(\FU*{LOGTEST} \VAR{int-a} \VAR{int-b})}
364 {Return \retval{\T} if
365 there is any bit set in \VAR{int-a} which is set in \VAR{int-b} as well.
368 \IT{(\FU*{LOGCOUNT} \VAR{integer})}
370 \retval{number of bits} set
371 in \VAR{integer}.
374 \IT{(\FU*{ASH} \VAR{\VAR{integer}} \VAR{count})}
376 Return copy of \retval{\VAR{integer}} arithmetically shifted left with zeros added
377 at the right, or, for $\VAR{count}<0$, shifted right discarding
378 bits.
381 \IT{(\FU*{MASK-FIELD} \VAR{byte-spec} \VAR{integer})}
383 Return copy of \retval{\VAR{integer}} with all bits unset but those denoted by
384 \VAR{byte-spec}. \kwd{setf}able.
388 \end{LIST}
390 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
391 \subsection{Integer Functions}
392 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
393 \begin{LIST}{1cm}
395 \IT{(\FU*{INTEGER-LENGTH} \VAR{integer})}
397 \retval{Number of bits} necessary to represent \VAR{integer}.
400 \IT{(\FU*{LDB-TEST} \VAR{byte-spec} \VAR{integer})}
402 Return \retval{\T} if any bit specified by \VAR{byte-spec} in
403 \VAR{integer} is set.
406 \IT{(\FU*{LDB} \VAR{byte-spec} \VAR{integer})}
408 Extract \retval{byte} denoted by \VAR{byte-spec} from
409 \VAR{integer}. \kwd{setf}able.
412 \IT{(\FU*{BYTE} \VAR{size} \VAR{position})}
414 \retval{Byte specifier} for a byte of \VAR{size} bits starting at a
415 weight of $2^{\VAR{position}}$.
418 \IT{\arrGOO{(\FU*{BYTE-SIZE} \VAR{ byte-spec})\\
419 (\FU*{BYTE-POSITION} \VAR{ byte-spec})}{.}}
421 \retval{Size} or \retval{position}, respective, of \VAR{byte-spec}.
424 \IT{(\xorGOO{\FU*{DEPOSIT-FIELD}\\
425 \FU*{DPB}}{\}}
426 \VAR{int-a} \VAR{byte-spec} \VAR{int-b})}
428 Return \retval{\VAR{int-b}} with bits denoted by \VAR{byte-spec} replaced
429 by corresponding bits of \VAR{int-a}, or by the low (\FU{byte-size}
430 \VAR{byte-spec}) bits of \VAR{int-a}, respectively.
433 \end{LIST}
436 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
437 \subsection[Implementation- Dependent]{Implementation-Dependent}
438 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
439 \begin{LIST}{1cm}
441 \IT{\arrGOO{\CNS{SHORT-FLOAT}\\
442 \CNS{SINGLE-FLOAT}\\
443 \CNS{DOUBLE-FLOAT}\\
444 \CNS{LONG-FLOAT}}{\}}\kwd{-}%
445 \xorGOO{\kwd{EPSILON}\\
446 \kwd{NEGATIVE-EPSILON}}{.}}
448 \index{SHORT-FLOAT-EPSILON}%
449 \index{SINGLE-FLOAT-EPSILON}%
450 \index{DOUBLE-FLOAT-EPSILON}%
451 \index{LONG-FLOAT-EPSILON}%
452 \index{SHORT-FLOAT-NEGATIVE-EPSILON}%
453 \index{SINGLE-FLOAT-NEGATIVE-EPSILON}%
454 \index{DOUBLE-FLOAT-NEGATIVE-EPSILON}%
455 \index{LONG-FLOAT-NEGATIVE-EPSILON}%
456 Smallest possible number making a difference when added or subtracted, respectively.
459 \IT{\arrGOO{%
460 \CNS{LEAST-NEGATIVE}\\
461 \CNS{LEAST-NEGATIVE-NORMALIZED}\\
462 \CNS{LEAST-POSITIVE}\\
463 \CNS{LEAST-POSITIVE-NORMALIZED}}{\}}%
464 \kwd{-}%
465 \xorGOO{%
466 \kwd{SHORT-FLOAT}\\
467 \kwd{SINGLE-FLOAT}\\
468 \kwd{DOUBLE-FLOAT}\\
469 \kwd{LONG-FLOAT}}{.}}
471 \index{LEAST-NEGATIVE-SHORT-FLOAT}%
472 \index{LEAST-NEGATIVE-NORMALIZED-SHORT-FLOAT}%
473 \index{LEAST-NEGATIVE-SINGLE-FLOAT}%
474 \index{LEAST-NEGATIVE-NORMALIZED-SINGLE-FLOAT}%
475 \index{LEAST-NEGATIVE-DOUBLE-FLOAT}%
476 \index{LEAST-NEGATIVE-NORMALIZED-DOUBLE-FLOAT}%
477 \index{LEAST-NEGATIVE-LONG-FLOAT}%
478 \index{LEAST-NEGATIVE-NORMALIZED-LONG-FLOAT}%
479 \index{LEAST-POSITIVE-SHORT-FLOAT}%
480 \index{LEAST-POSITIVE-NORMALIZED-SHORT-FLOAT}%
481 \index{LEAST-POSITIVE-SINGLE-FLOAT}%
482 \index{LEAST-POSITIVE-NORMALIZED-SINGLE-FLOAT}%
483 \index{LEAST-POSITIVE-DOUBLE-FLOAT}%
484 \index{LEAST-POSITIVE-NORMALIZED-DOUBLE-FLOAT}%
485 \index{LEAST-POSITIVE-LONG-FLOAT}%
486 \index{LEAST-POSITIVE-NORMALIZED-LONG-FLOAT}%
487 Available numbers closest to $-0$ or $+0$, respectively.
490 \IT{\arrGOO{\CNS{MOST-NEGATIVE}\\
491 \CNS{MOST-POSITIVE}}{\}}%
492 \kwd{-}%
493 \xorGOO{%
494 \kwd{DOUBLE-FLOAT}\\
495 \kwd{LONG-FLOAT}\\
496 \kwd{SHORT-FLOAT}\\
497 \kwd{SINGLE-FLOAT}\\
498 \kwd{FIXNUM}}{.}}
500 \index{MOST-NEGATIVE-DOUBLE-FLOAT}%
501 \index{MOST-NEGATIVE-LONG-FLOAT}%
502 \index{MOST-NEGATIVE-SHORT-FLOAT}%
503 \index{MOST-NEGATIVE-SINGLE-FLOAT}%
504 \index{MOST-NEGATIVE-FIXNUM}%
505 \index{MOST-POSITIVE-DOUBLE-FLOAT}%
506 \index{MOST-POSITIVE-LONG-FLOAT}%
507 \index{MOST-POSITIVE-SHORT-FLOAT}%
508 \index{MOST-POSITIVE-SINGLE-FLOAT}%
509 \index{MOST-POSITIVE-FIXNUM}%
510 Available numbers closest to $-\infty$ or $+\infty$, respectively.
513 \IT{\arrGOO{(\FU*{DECODE-FLOAT} \VAR{ n})\\
514 (\FU*{INTEGER-DECODE-FLOAT} \VAR{ n})}{.}}
516 Return \retval{significand}, \retvalii{exponent}, and
517 \retvaliii{sign} of \kwd{float} \VAR{n}.
520 \IT{(\FU*{SCALE-FLOAT} \VAR{n} \Op{\VAR{i}})}
522 With \VAR{n}'s radix $b$, return $n b^{i}$.
525 \IT{\arrGOO{
526 (\FU*{FLOAT-RADIX} \VAR{ n})\\
527 (\FU*{FLOAT-DIGITS} \VAR{ n})\\
528 (\FU*{FLOAT-PRECISION} \VAR{ n})}{.}}
530 \retval{Radix}, \retval{number of digits} in that radix, or
531 \retval{precision} in that radix, respectively, of float \VAR{n}.
534 \IT{(\FU*{UPGRADED-COMPLEX-PART-TYPE} \VAR{foo})}
535 {\retval{Type} of
536 most specialized complex number able to hold parts of type \VAR{foo}.
539 \end{LIST}
542 % LocalWords: de na der nored ored