File: concept-numbers.tex

package info (click to toggle)
gclinfo 2.2-9
  • links: PTS
  • area: main
  • in suites: potato
  • size: 3,928 kB
  • ctags: 15
  • sloc: sed: 1,681; makefile: 127; lisp: 58; sh: 40
file content (639 lines) | stat: -rw-r--r-- 24,883 bytes parent folder | download | duplicates (4)
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
% -*- Mode: TeX -*-

\beginsubsection{Numeric Operations}
\DefineSection{NumericOperations}

\clisp\ provides a large variety of operations related to \term{numbers}.
This section provides an overview of those operations by grouping them
into categories that emphasize some of the relationships among them.

\Thenextfigure\ shows \term{operators} relating to
arithmetic operations.

\displaythree{Operators relating to Arithmetic.}{
*&1+&gcd\cr
+&1-&incf\cr
-&conjugate&lcm\cr
/&decf&\cr
}

\Thenextfigure\ shows \term{defined names} relating to
exponential, logarithmic, and trigonometric operations.

\displaythree{Defined names relating to Exponentials, Logarithms, and Trigonometry.}{
abs&cos&signum\cr
acos&cosh&sin\cr
acosh&exp&sinh\cr
asin&expt&sqrt\cr
asinh&isqrt&tan\cr
atan&log&tanh\cr
atanh&phase&\cr
cis&pi&\cr
}

\Thenextfigure\ shows \term{operators} relating to
numeric comparison and predication.

\displaythree{Operators for numeric comparison and predication.}{
/=&>=&oddp\cr
<&evenp&plusp\cr
<=&max&zerop\cr
=&min&\cr
>&minusp&\cr
}

\Thenextfigure\ shows \term{defined names} relating to
numeric type manipulation and coercion.

\displaythree{Defined names relating to numeric type manipulation and coercion.}{
ceiling&float-radix&rational\cr
complex&float-sign&rationalize\cr
decode-float&floor&realpart\cr
denominator&fround&rem\cr
fceiling&ftruncate&round\cr
ffloor&imagpart&scale-float\cr
float&integer-decode-float&truncate\cr
float-digits&mod&\cr
float-precision&numerator&\cr
}

\beginsubsubsection{Associativity and Commutativity in Numeric Operations}

For functions that are mathematically associative (and possibly commutative),
a \term{conforming implementation} may process the \term{arguments} in any manner 
consistent with associative (and possibly commutative) rearrangement.  This does not
affect the order in which the \term{argument} \term{forms} are \term{evaluated};
for a discussion of evaluation order, \seesection\FunctionForms.
What is unspecified is only the order in which the \term{parameter} \term{values}
are processed.  This implies that \term{implementations} may differ in which 
automatic \term{coercions} are applied; \seesection\NumericContagionRules.

A \term{conforming program} can control the order of processing explicitly by 
separating the operations into separate (possibly nested) \term{function forms},
or by writing explicit calls to \term{functions} that perform coercions.

\beginsubsubsubsection{Examples of Associativity and Commutativity in Numeric Operations}

Consider the following expression, in which we assume that \f{1.0} and
\f{1.0e-15} both denote \term{single floats}:

\code
 (+ 1/3 2/3 1.0d0 1.0 1.0e-15)
\endcode

One \term{conforming implementation} might
process the \term{arguments} from left to right,
first adding \f{1/3} and \f{2/3} to get \f{1}, 
then converting that to a \term{double float} 
for combination with \f{1.0d0},
then successively converting and adding \f{1.0} and \f{1.0e-15}.

Another \term{conforming implementation} might process the \term{arguments} from
right to left, first performing a \term{single float} addition of \f{1.0} and
\f{1.0e-15} (perhaps losing accuracy in the process), then converting the sum to 
a \term{double float} and adding \f{1.0d0}, then converting \f{2/3} to a
\term{double float} and adding it, and then converting \f{1/3} and adding that.

A third \term{conforming implementation} might first scan all the \term{arguments},
process all the \term{rationals} first to keep that part of the computation exact,
then find an \term{argument} of the largest floating-point format among all the
\term{arguments} and add that, and then add in all other \term{arguments}, converting
each in turn (all in a perhaps misguided attempt to make the computation as accurate
as possible).

In any case, all three strategies are legitimate.

A \term{conforming program} could control the order by writing, for example,

\code
 (+ (+ 1/3 2/3) (+ 1.0d0 1.0e-15) 1.0)
\endcode

\endsubsubsubsection%{Examples of Associativity and Commutativity in Numeric Operations}

\endsubsubsection%{Associativity and Commutativity in Numeric Operations}

\beginsubsubsection{Contagion in Numeric Operations}
\DefineSection{NumericContagionRules}

For information about the contagion rules for implicit coercions of \term{arguments} 
in numeric operations, see
     \secref\RuleOfFloatPrecisionContagion, 
     \secref\RuleOfFloatAndRationalContagion,
 and \secref\RuleOfComplexContagion.

\endsubsubsection%{Contagion in Numeric Operations}

\beginsubsubsection{Viewing Integers as Bits and Bytes}

\beginsubsubsubsection{Logical Operations on Integers}

%% 12.7.0 1
%% 12.7.0 2
Logical operations require \term{integers} as arguments;
%!!! Is this a formal use of "should be signaled"? -kmp 13-May-91
an error \oftype{type-error} should be signaled 
if an argument is supplied that is not an \term{integer}.
\term{Integer} arguments to logical operations are treated as if
they were represented in two's-complement notation.
%Internally an implementation 
%might or might not use a two's-complement representation.


\Thenextfigure\ shows \term{defined names} relating to
logical operations on numbers.

\displaythree{Defined names relating to logical operations on numbers.}{
ash&boole-ior&logbitp\cr
boole&boole-nand&logcount\cr
boole-1&boole-nor&logeqv\cr
boole-2&boole-orc1&logior\cr
boole-and&boole-orc2&lognand\cr
boole-andc1&boole-set&lognor\cr
boole-andc2&boole-xor&lognot\cr
boole-c1&integer-length&logorc1\cr
boole-c2&logand&logorc2\cr
boole-clr&logandc1&logtest\cr
boole-eqv&logandc2&logxor\cr
}                    
                    
\endsubsubsubsection%{Logical Operations on Integers}

\beginsubsubsubsection{Byte Operations on Integers}

%% 12.8.0 2
The byte-manipulation \term{functions} use \term{objects} 
called \term{byte specifiers} to designate the size and position
of a specific \term{byte} within an \term{integer}.
The representation of a \term{byte specifier} is \term{implementation-dependent};
it might or might not be a \term{number}.
\Thefunction{byte} will construct a \term{byte specifier},
which various other byte-manipulation \term{functions} will accept.

\Thenextfigure\ shows \term{defined names} relating to
manipulating \term{bytes} of \term{numbers}.

\displaythree{Defined names relating to byte manipulation.}{
byte&deposit-field&ldb-test\cr
byte-position&dpb&mask-field\cr
byte-size&ldb&\cr
}

\endsubsubsubsection%{Byte Operations on Integers}

\endsubsubsection%{Viewing Integers as Bits and Bytes}

\endsubsection%{Numeric Operations}

\beginSubsection{Implementation-Dependent Numeric Constants}

\Thenextfigure\ shows \term{defined names} relating to
\term{implementation-dependent} details about \term{numbers}.

\displaytwo{Defined names relating to implementation-dependent details about numbers.}{
double-float-epsilon&most-negative-fixnum\cr
double-float-negative-epsilon&most-negative-long-float\cr
least-negative-double-float&most-negative-short-float\cr
least-negative-long-float&most-negative-single-float\cr
least-negative-short-float&most-positive-double-float\cr
least-negative-single-float&most-positive-fixnum\cr
least-positive-double-float&most-positive-long-float\cr
least-positive-long-float&most-positive-short-float\cr
least-positive-short-float&most-positive-single-float\cr
least-positive-single-float&short-float-epsilon\cr
long-float-epsilon&short-float-negative-epsilon\cr
long-float-negative-epsilon&single-float-epsilon\cr
most-negative-double-float&single-float-negative-epsilon\cr
}

\endSubsection%{Implementation-Dependent Numeric Constants}
\beginsubsection{Rational Computations}
\DefineSection{RationalComputations}

%% 12.1.0 2
The rules in this section apply to \term{rational} computations.

\beginsubsubsection{Rule of Unbounded Rational Precision}

Rational computations cannot overflow in the usual sense 
(though there may not be enough storage to represent a result), 
since \term{integers} and \term{ratios} may in principle be of any magnitude.
            
\endsubsubsection%{Rule of Unbounded Rational Precision}

\beginsubsubsection{Rule of Canonical Representation for Rationals}

%% 2.1.2 2
%% 12.1.0 5
If any computation produces a result that is a mathematical ratio of two integers
such that the denominator evenly divides the numerator, then the result is converted
to the equivalent \term{integer}.  

%% 2.1.2 1         
%% This had been removed, but I couldn't figure out why,
%% so I reinstated it. -kmp 19-Oct-91
If the denominator does not evenly divide the numerator,
the canonical representation of a \term{rational} number is as the \term{ratio}
that numerator and that denominator, where the greatest common divisor of
the numerator and denominator is one, and where the denominator is positive
and greater than one.

When used as input (in the default syntax),
the notation \f{-0} always denotes the \term{integer} \f{0}.
A \term{conforming implementation} must not have a
representation of ``minus zero'' for \term{integers}
that is distinct from its representation of zero for \term{integers}.
However, such a distinction is possible for \term{floats}; 
see \thetype{float}.

\endsubsubsection%{Rule of Canonical Representation for Rationals}

\beginsubsubsection{Rule of Float Substitutability}
\DefineSection{FloatSubstitutability}

%% 12.5.0 4
When the arguments to an irrational mathematical \term{function} 
\reviewer{Barmar: There should be a table of these functions.}
are all \term{rational} and the true mathematical result
is also (mathematically) rational, then unless otherwise noted
an implementation is free to return either an accurate
\term{rational} result
or a \term{single float} approximation.
If the arguments are all \term{rational} 
but the result cannot be expressed
as a \term{rational} number, then a \term{single float} 
approximation is always returned.

\issue{COMPLEX-RATIONAL-RESULT:EXTEND}
If the arguments to a mathematical \term{function} are all of type
  \f{(or rational (complex rational))} 
and the true mathematical result is
  (mathematically) a complex number with rational real and imaginary
  parts, then unless otherwise noted an implementation is free to return
  either an accurate result of type \f{(or rational (complex rational))} 
or
  a \term{single float}
  (permissible only if the imaginary part of the true mathematical
  result is zero) or \f{(complex single-float)}. If the arguments are
  all of type \f{(or rational (complex rational))}
but the result cannot be
  expressed as a \term{rational} or \term{complex rational},
then the returned
  value will be \oftype{single-float} 
(permissible only if the imaginary
  part of the true mathematical result is zero) or \f{(complex single-float)}.
\endissue{COMPLEX-RATIONAL-RESULT:EXTEND}
 
\tablefigtwo{Functions Affected by Rule of Float Substitutability}%
{Function}{Sample Results}{
\funref{abs}    & \f{(abs \#c(3 4)) \EV\ 5 \i{or} 5.0} \cr
\funref{acos}   & \f{(acos 1) \EV\ 0 \i{or} 0.0} \cr
\funref{acosh}  & \f{(acosh 1) \EV\ 0 \i{or} 0.0} \cr
\funref{asin}   & \f{(asin 0) \EV\ 0 \i{or} 0.0} \cr
\funref{asinh}  & \f{(asinh 0) \EV\ 0 \i{or} 0.0} \cr
\funref{atan}   & \f{(atan 0) \EV\ 0 \i{or} 0.0} \cr
\funref{atanh}  & \f{(atanh 0) \EV\ 0 \i{or} 0.0} \cr
\funref{cis}    & \f{(cis 0) \EV\ \#c(1 0) \i{or} \#c(1.0 0.0)} \cr
\funref{cos}    & \f{(cos 0) \EV\ 1 \i{or} 1.0} \cr
\funref{cosh}   & \f{(cosh 0) \EV\ 1 \i{or} 1.0} \cr
\funref{exp}    & \f{(exp 0) \EV\ 1 \i{or} 1.0} \cr
\funref{expt}   & \f{(expt 8 1/3) \EV\ 2 \i{or} 2.0} \cr
\funref{log}    & \f{(log 1) \EV\ 0 \i{or} 0.0} \cr
                & \f{(log 8 2) \EV\ 3 \i{or} 3.0} \cr
\funref{phase}  & \f{(phase 7) \EV\ 0 \i{or} 0.0} \cr
\funref{signum} & \f{(signum \#c(3 4)) \EV\ \#c(3/5 4/5) \i{or} \#c(0.6 0.8)} \cr
\funref{sin}    & \f{(sin 0) \EV\ 0 \i{or} 0.0} \cr
\funref{sinh}   & \f{(sinh 0) \EV\ 0 \i{or} 0.0} \cr
\funref{sqrt}   & \f{(sqrt 4) \EV\ 2 \i{or} 2.0} \cr
                & \f{(sqrt 9/16) \EV\ 3/4 \i{or} 0.75} \cr
\funref{tan}    & \f{(tan 0) \EV\ 0 \i{or} 0.0} \cr
\funref{tanh}   & \f{(tanh 0) \EV\ 0 \i{or} 0.0} \cr
}

\endsubsubsection%{Rule of Float Substitutability}

\endsubsection%{Rational Computations}
\beginsubsection{Floating-point Computations}
\DefineSection{FloatingPointComputations}

The following rules apply to floating point computations.

\issue{CONTAGION-ON-NUMERICAL-COMPARISONS:TRANSITIVE}
\beginsubsubsection{Rule of Float and Rational Contagion}
\DefineSection{RuleOfFloatAndRationalContagion}
%% Barmar noted that the following was said in two different places.
%%  I've removed the most casually worded of the two.
%%  Hopefully no useful info was lost in the process. -kmp 19-Oct-91
% For \term{functions} that combine arguments of different \term{types},
% when one argument is a \term{rational} and the other is a \term{float},
% the \term{rational} is first converted to a \term{float} of the same format.  
% For \term{functions} that compare arguments of different \term{types},
% when one argument is a \term{rational} and the other is 
% a \term{float}, \thefunction{rational} is effectively
% called to convert the \term{float} to a \term{rational} and then an exact
% comparison is performed. In the case of \term{complex} numbers, the real and 
% imaginary parts are effectively handled individually.

%% 12.1.0 3
When \term{rationals} and \term{floats} are combined by a numerical function, 
the \term{rational} is first converted to a \term{float} of the same format.
For \term{functions} such as \funref{+} that take more than two arguments,
it is permitted that part of the operation be carried out exactly using
\term{rationals} and the rest be done using floating-point arithmetic.

When \term{rationals} and \term{floats} are compared by a numerical function, 
\thefunction{rational} is effectively called to convert the \term{float} 
to a \term{rational} and then an exact
comparison is performed. In the case of \term{complex} numbers,
the real and imaginary parts are effectively handled individually.

\beginsubsubsubsection{Examples of Rule of Float and Rational Contagion}

\code
 ;;;; Combining rationals with floats.
 ;;; This example assumes an implementation in which 
 ;;; (float-radix 0.5) is 2 (as in IEEE) or 16 (as in IBM/360),
 ;;; or else some other implementation in which 1/2 has an exact 
 ;;;  representation in floating point.
 (+ 1/2 0.5) \EV 1.0
 (- 1/2 0.5d0) \EV 0.0d0
 (+ 0.5 -0.5 1/2) \EV 0.5

 ;;;; Comparing rationals with floats.
 ;;; This example assumes an implementation in which the default float 
 ;;; format is IEEE single-float, IEEE double-float, or some other format
 ;;; in which 5/7 is rounded upwards by FLOAT.
 (< 5/7 (float 5/7)) \EV \term{true}
 (< 5/7 (rational (float 5/7))) \EV \term{true}
 (< (float 5/7) (float 5/7)) \EV \term{false}
\endcode
% (< 5/7 (rationalize (float 5/7))) \EV \term{implementation-dependent}
% Moon: The rationalize example is screwy since the two lines preceding it are also 
% implementation-dependent.  Also I don't think it sheds any light on
% the issue at hand (see the name of the subsubsection), so flush it.

\endsubsubsection%{Examples of Rule of Float and Rational Contagion}

\endissue{CONTAGION-ON-NUMERICAL-COMPARISONS:TRANSITIVE}

\endsubsubsection%{Rule of Float and Rational Contagion}

\beginsubsubsection{Rule of Float Approximation}
%% 12.1.0 1
%% 12.5.0 3
Computations with \term{floats} are only approximate,
although they are described as if the results
were mathematically accurate. 
Two mathematically identical
expressions may be computationally different because of errors
inherent in the floating-point approximation process.
The precision of a \term{float} is not necessarily
correlated with the accuracy of that number.
For instance, 3.142857142857142857 is a more precise approximation
to $\pi$ than 3.14159, but the latter is more accurate.
The precision refers to the number of bits retained in the representation.
When an operation combines a \term{short float} with a 
\term{long float},
the result will be a \term{long float}. 
\clisp\ functions assume that the accuracy of
arguments to them does not exceed their precision.  Therefore
when two \term{small floats} 
are combined, the result is a \term{small float}. 
\clisp\ functions 
never convert automatically from a larger size to a smaller one.
\endsubsubsection%{Rule of Float Approximation}

\beginsubsubsection{Rule of Float Underflow and Overflow}

%% 12.1.0 2
An error of \term{type} \typeref{floating-point-overflow}
or \typeref{floating-point-underflow} should be signaled if a 
floating-point computation causes exponent overflow or underflow, respectively.

\endsubsubsection%{Rule of Float Underflow and Overflow}

\beginsubsubsection{Rule of Float Precision Contagion} 
\DefineSection{RuleOfFloatPrecisionContagion}

%% The following was said in two different places.
%%  I've removed the most casually worded of the two.
%%  Hopefully no useful info was lost in the process. -kmp 19-Oct-91
% When a shorter \term{float} is combined with a longer one in an operation,
% the result will be of the \term{type} of the longer of the two \term{floats}.

%% 12.1.0 5
The result of a numerical function is a \term{float} of the 
largest format among all the floating-point arguments to the \term{function}. 

\endsubsubsection%{Rule of Float Precision Contagion} 

\endsubsection%{Floating-point Computations}
\beginsubsection{Complex Computations}
\DefineSection{ComplexComputations}

%% 12.1.0 6
The following rules apply to \term{complex} computations:

\beginsubsubsection{Rule of Complex Substitutability}

%% Rewritten by KMP.
% Except during the execution of irrational and transcendental \term{functions},
% \term{complex} numbers never result from a numerical \term{function}
% unless one or more of the \term{arguments} is \term{complex}.
Except during the execution of irrational and transcendental \term{functions},
no numerical \term{function} ever \term{yields} a \term{complex} unless 
one or more of its \term{arguments} is a \term{complex}.

\endsubsubsection%{Rule of Complex Substitutability}

\beginsubsubsection{Rule of Complex Contagion}

\DefineSection{RuleOfComplexContagion}
% When a 
% \issue{REAL-NUMBER-TYPE:X3J13-MAR-89}
% \term{real}
% \endissue{REAL-NUMBER-TYPE:X3J13-MAR-89}
% number 
% \reviewer{Barmar: I don't like the word `meets' here.}
% \editornote{KMP: This is all said redundantly in \secref\ComplexComputations\ below,
% 	         so maybe we can merge the two, somehow.} %!!! 26-Dec-90
% meets a \term{complex} number, the 
% \issue{REAL-NUMBER-TYPE:X3J13-MAR-89}
% \term{real}
% \endissue{REAL-NUMBER-TYPE:X3J13-MAR-89}
% number is in effect first converted to a 
% \term{complex} number by providing an
% imaginary part of {\tt $0$}.
When a 
\issue{REAL-NUMBER-TYPE:X3J13-MAR-89}
\term{real}
\endissue{REAL-NUMBER-TYPE:X3J13-MAR-89}
and 
a \term{complex} are both part of a computation, 
the 
\issue{REAL-NUMBER-TYPE:X3J13-MAR-89}
\term{real}
\endissue{REAL-NUMBER-TYPE:X3J13-MAR-89}
is first converted to a \term{complex} by providing an imaginary part of \f{0}.
\endsubsubsection%{Rule of Complex Contagion}

\beginsubsubsection{Rule of Canonical Representation for Complex Rationals}
\DefineSection{RuleOfCanonRepForComplexRationals}

%% 12.1.0 8
If the result of any computation would be a \term{complex}
number whose real part is \oftype{rational} and whose imaginary
part is zero, the result is converted to the \term{rational} 
which is the real part.
This rule does not apply to \term{complex} numbers whose parts
are \term{floats}. 
For example, \f{\#C(5 0)} and \f{5} are not \term{different} \term{objects} in \clisp
(they are always the \term{same} under \funref{eql});
\f{\#C(5.0 0.0)} and \f{5.0} are always \term{different} \term{objects} in \clisp\
(they are never the \term{same} under \funref{eql},
although they are the \term{same} under \funref{equalp} and \funref{=}).

\beginsubsubsubsection{Examples of Rule of Canonical Representation for Complex Rationals}

\code
 #c(1.0 1.0) \EV #C(1.0 1.0)
 #c(0.0 0.0) \EV #C(0.0 0.0)
 #c(1.0 1) \EV #C(1.0 1.0)
 #c(0.0 0) \EV #C(0.0 0.0)
 #c(1 1) \EV #C(1 1)
 #c(0 0) \EV 0
 (typep #c(1 1) '(complex (eql 1))) \EV \term{true}
 (typep #c(0 0) '(complex (eql 0))) \EV \term{false}
\endcode

\endsubsubsubsection%{Examples of Rule of Canonical Representation for Complex Rationals}

\endsubsubsection%{Rule of Canonical Representation for Complex Rationals}

\beginsubsubsection{Principal Values and Branch Cuts}

%% 12.5.3 1
Many of the irrational and transcendental functions are multiply defined
in the complex domain; for example, there are in general an infinite
number of complex values for the logarithm function.  In each such
case, a \term{principal} \term{value} must be chosen for the function to return.
In general, such values cannot be chosen so as to make the range
continuous; lines in the domain
called branch cuts must be defined, which in turn
define the discontinuities in the range.
%% 12.5.3 2
\clisp\ defines the branch cuts, \term{principal} \term{values}, and boundary
conditions for the complex functions following ``{\PrincipalValues}.'' The branch
cut rules that apply to each function are located with the description of
that function.

%% 12.5.3 17
\Thenextfigure\ lists
the identities that are obeyed
throughout the applicable portion of the complex domain, even on
the branch cuts:

\showthree{Trigonometric Identities for Complex Domain}{
sin i z = i sinh z  &  sinh i z = i sin z        &  arctan  i z = i arctanh z \cr
cos i z = cosh z    &  cosh i z = cos z          &  arcsinh i z = i arcsin z  \cr
tan i z = i tanh z  &  arcsin i z = i arcsinh z  &  arctanh i z = i arctan z  \cr
}

The quadrant numbers referred to in the discussions of branch cuts are as illustrated
in \thenextfigure.

% JGA requested this.
% This is amazingly low-tex and the spacing of dots isn't quite right,
% but I think it's good enough to be intelligible and will suffice until and
% unless something better is devised. -kmp 3-Feb-92
\code
                           Imaginary Axis
	                         |
	        		 |
	        	II       |        I
	        	         |
	        	         |
	        	         |
	       ______________________________________ Real Axis
	        	         |
	        	         |
	        	         |
	               III       |     	   IV
	        		 |
	        		 |
	        		 |
	        		 |

\endcode
\simplecaption{Quadrant Numbering for Branch Cuts}

\endsubsubsection%{Principal Values and Branch Cuts}

\endsubsection%{Complex Computations}

\beginsubsection{Interval Designators}
\DefineSection{IntervalDesignators}

The \term{compound type specifier} form of the numeric \term{type specifiers}
in \thenextfigure\ permit the user to specify an interval on the real number line
which describe a \term{subtype} of the \term{type} which would be described by the
corresponding \term{atomic type specifier}.  A \term{subtype} of some \term{type}
\param{T} is specified using an ordered pair of \term{objects} called
\term{interval designators} for \term{type} \param{T}.

The first of the two \term{interval designators} for \term{type} \param{T} can be
any of the following:

\beginlist

\itemitem{a number \param{N} of \term{type} \param{T}}

This denotes a lower inclusive bound of \param{N}.  That is, \term{elements}
of the \term{subtype} of \param{T} will be greater than or equal to \param{N}.

\itemitem{a \term{singleton} \term{list} whose \term{element} is
	  a number \param{M} of \term{type} \param{T}}

This denotes a lower exclusive bound of \param{M}.  That is, \term{elements}
of the \term{subtype} of \param{T} will be greater than \param{M}.

\itemitem{the symbol \misc{*}}

This denotes the absence of a lower bound on the interval.

\endlist

The second of the two \term{interval designators} for \term{type} \param{T} can be
any of the following:

\beginlist

\itemitem{a number \param{N} of \term{type} \param{T}}

This denotes an upper inclusive bound of \param{N}.  That is, \term{elements}
of the \term{subtype} of \param{T} will be less than or equal to \param{N}.

\itemitem{a \term{singleton} \term{list} whose \term{element} is
	  a number \param{M} of \term{type} \param{T}}

This denotes an upper exclusive bound of \param{M}.  That is, \term{elements}
of the \term{subtype} of \param{T} will be less than \param{M}.

\itemitem{the symbol \misc{*}}

This denotes the absence of an upper bound on the interval.

\endlist

\endsubsection%{Interval Designators}

\beginsubsection{Random-State Operations}

\Thenextfigure\ lists some \term{defined names} that are applicable to \term{random states}.

\displaythree{Random-state defined names}{
*random-state*&random&\cr
make-random-state&random-state-p&\cr
}

\endsubsection%{Random-State Operations}