1
0
mirror of synced 2026-02-17 05:17:12 +00:00
Files
Interlisp.medley/docs/medley-irm/07-NUMBERS.TEDIT
Arun Welch 615885a0fa New version of IRM (#665)
* New version of IRM

New version of the IRM, updated to Medley.

* moved to docs/medley-irm as discussed
2022-02-12 14:05:10 -08:00

569 lines
52 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
INTERLISP-D REFERENCE MANUAL
NUMBERS AND ARITHMETIC FUNCTIONS
"7"7. NUMBERS AND ARITHMETIC FUNCTIONS
3
There are four different types of numbers(NUMBERS NIL Numbers NIL ("7") 1) in Interlisp: small integers(NUMBERS NIL Numbers NIL ("7") 1 SUBNAME SMALL% INTEGERS SUBTEXT small% integers), large integers(NUMBERS NIL Numbers NIL ("7") 1 SUBNAME LARGE% INTEGERS SUBTEXT large% integers), bignums (arbitrary-size integers)(NUMBERS NIL Numbers NIL ("7") 1 SUBNAME BIGNUMS SUBTEXT bignums), and floating-point numbers(NUMBERS NIL Numbers NIL ("7") 1 SUBNAME FLOATING-POINT SUBTEXT floating-point). Small integers are in the range -65536 to 65535. Large integers and floating-point numbers are 32-bit quantities that are stored by ªboxingº the number (see below). Bignums are ªboxedº as a series of words.
Large integers and floating-point numbers can be any full word quantity. To distinguish among the various kinds of numbers, and other Interlisp pointers, these numbers are ªboxedº When a large integer or floating-point number is created (by an arithmetic operation or by READ), Interlisp gets a new word from ªnumber storageº and puts the number into that word. Interlisp then passes around the pointer to that word, i.e., the ªboxed number(BOXED% NUMBERS NIL Boxed% numbers NIL ("7") 1)º, rather than the actual quantity itself. When a numeric function needs the actual numeric quantity, it performs the extra level of addressing to obtain the ªvalueº of the number. This latter process is called ªunboxingº. Unboxing does not use any storage, but each boxing operation uses one new word of number storage. If a computation creates many large integers or floating-point numbers, i.e., does lots of boxes, it may cause a garbage collection of large integer space, or of floating-point number space.
The following functions can be used to distinguish the different types of numbers:
(SMALLP(SMALLP (Function) NIL NIL ("7") 1) X) [Function]
Returns X, if X is a small integer; NIL otherwise. Does not generate an error if X is not a number.
(FIXP(FIXP (Function) NIL NIL ("7") 1) X) [Function]
Returns X, if X is an integer; NIL otherwise. Note that FIXP is true for small integers, large integers, and bignums. Does not generate an error if X is not a number.
(FLOATP(FLOATP (Function) NIL NIL ("7") 1) X) [Function]
Returns X if X is a floating-point number; NIL otherwise. Does not give an error if X is not a number.
(NUMBERP(NUMBERP (Function) NIL NIL ("7") 1) X) [Function]
Returns X, if X is a number of any type; NIL otherwise. Does not generate an error if X is not a number.
Note: In previous releases, NUMBERP was true only if (FLOATP X) or (FIXP X) were true. With the additon of Common Lisp ratios and complex numbers, NUMBERP now returns T for all number types . Code relying on the "old" behavior should be modified.
Each small integer has a unique representation, so EQ may be used to check equality. EQ should not be used for large integers, bignums, or floating-point numbers, EQP, IEQP, or EQUAL must be used instead.
(EQP(EQP (Function) NIL NIL ("7") 1) X Y) [Function]
Returns T, if X and Y are equal numbers; NIL otherwise. EQ may be used if X and Y are known to be small integers. EQP does not convert X and Y to integers, e.g., (EQP 2000 2000.3) => NIL, but it can be used to compare an integer and a floating-point number, e.g., (EQP 2000 2000.0) => T. EQP does not generate an error if X or Y are not numbers.
EQP can also be used to compare stack pointers (see Chapter 11) and compiled code objects (see Chapter 10).
The action taken on division by zero and floating-point overflow is determined with the following function:
(OVERFLOW(OVERFLOW (Function) NIL NIL ("7") 2) FLG) [Function]
Sets a flag that determines the system response to arithmetic overflow (for floating-point arithmetic) and division by zero; returns the previous setting.
For integer arithmetic: If FLG = T, an error occurs on division by zero. If FLG = NIL or 0, integer division by zero returns zero. Integer overflow cannot occur, because small integers are converted to bignums (see the beginning of this chapter).
For floating-point arithmetic: If FLG = T, an error occurs on floating overflow or floating division by zero. If FLG = NIL or 0, the largest (or smallest) floating-point number is returned as the result of the overflowed computation or floating division by zero.
The default value for OVERFLOW is T, meaning an error is generated on division by zero or floating overflow.
Generic Arithmetic(GENERIC% ARITHMETIC NIL Generic% arithmetic NIL ("7") 2)(ARITHMETIC NIL Arithmetic NIL ("7") 2 SUBNAME GENERIC SUBTEXT generic)
1
The functions in this section are ªgenericº arithmetic functions. If any of the arguments are floating-point numbers (see the Floating-Point Arithmetic section below), they act exactly like floating-point functions, floating all arguments and returning a floating-point number as their value. Otherwise, they act like the integer functions (see the Integer Arithmetic section below). If given a non-numeric argument, they generate an error, Non-numeric arg. The results of division by zero and floating-point overflow is determined by the function OVERFLOW (see the section above).
(PLUS(PLUS (Function) NIL NIL ("7") 2) X1 X2 ... XN) [NoSpread Function]
X1 + X2 + ... + XN.
(MINUS(MINUS (Function) NIL NIL ("7") 2) X) [Function]
- X
(DIFFERENCE(DIFFERENCE (Function) NIL NIL ("7") 2) X Y) [Function]
X - Y
((TIMES (Function) NIL NIL ("7") 2)TIMES X1 X2 ... XN) [NoSpread Function]
X1 * X2 * ... * XN
(QUOTIENT(QUOTIENT (Function) NIL NIL ("7") 2) X Y) [Function]
If X and Y are both integers, returns the integer division of X and Y. Otherwise, converts both X and Y to floating-point numbers, and does a floating-point division.
(REMAINDER(REMAINDER (Function) NIL NIL ("7") 3) X Y) [Function]
If X and Y are both integers, returns (IREMAINDER X Y), otherwise (FREMAINDER X Y).
(GREATERP (GREATERP% (Function) NIL NIL ("7") 3)X Y) [Function]
T, if X > Y, NIL otherwise.
(LESSP(LESSP (Function) NIL NIL ("7") 3) X Y) [Function]
T if X < Y, NIL otherwise.
(GEQ(GEQ (Function) NIL NIL ("7") 3) X Y) [Function]
T, if X >= Y, NIL otherwise.
(LEQ(LEQ (Function) NIL NIL ("7") 3) X Y) [Function]
T, if X <= Y, NIL otherwise.
(ZEROP(ZEROP (Function) NIL NIL ("7") 3) X) [Function]
The same as (EQP X 0).
(MINUSP(MINUSP (Function) NIL NIL ("7") 3) X) [Function]
T, if X is negative; NIL otherwise. Works for both integers and floating-point numbers.
(MIN(MIN (Function) NIL NIL ("7") 3) X1 X2 ... XN) [NoSpread Function]
Returns the minimum of X1, X2, ..., XN. (MIN) returns the value of MAX.INTEGER (see the Integer Arithmetic section below).
(MAX(MAX (Function) NIL NIL ("7") 3) X1 X2 ... XN) [NoSpread Function]
Returns the maximum of X1, X2, ..., XN. (MAX) returns the value of MIN.INTEGER (see the Integer Arithmetic section below).
(ABS(ABS (Function) NIL NIL ("7") 3) X) [Function]
X if X > 0, otherwise -X. ABS uses GREATERP and MINUS (not IGREATERP and IMINUS).
Integer Arithmetic(ARITHMETIC NIL Arithmetic NIL ("7") 3 SUBNAME INTEGER SUBTEXT integer)(INTEGER% ARITHMETIC NIL Integer% arithmetic NIL ("7") 3)
1
The input syntax for an integer is an optional sign (+ or -) followed by a sequence of decimal digits, and terminated by a delimiting character. Integers entered with this syntax are interpreted as decimal integers. Integers in other radices can be entered as follows:
123Q
#o123 If an integer is followed by the letter Q, or preceeded by a pound sign and the letter ªoº, the digits are interpreted as an octal (base 8) integer.
#b10101 If an integer is preceeded by a pound sign and the letter ªbº, the digits are interpreted as a binary (base 2) integer.
#x1A90 If an integer is preceeded by a pound sign and the letter ªxº, the digits are interpreted as a hexadecimal (base 16) integer.
#5r1243 If an integer is preceeded by a pound sign, a positive decimal integer BASE, and the letter ªrº, the digits are interpreted as an integer in the base BASE. For example, #8r123 = 123Q, and #16r12A3 = #x12A3. When typing a number in a radix above ten, the uppercase letters A through Z can be used as the digits after 9 (but there is no digit above Z, so it is not possible to type all base-99 digits).
Medley keeps no record of how you typed a number, so 77Q and 63 both correspond to the same integer, and are indistinguishable internally. The function RADIX (see Chapter 25), sets the radix used to print integers.
PACK and MKATOM create numbers when given a sequence of characters observing the above syntax, e.g. (PACK '(1 2 Q)) => 10. Integers are also created as a result of arithmetic operations.
The range of integers of various types is implementation-dependent. This information is accessible to you through the following variables:
MIN.SMALLP(MIN.SMALLP (Variable) NIL NIL ("7") 4) [Variable]
MAX.SMALLP(MAX.SMALLP (Variable) NIL NIL ("7") 4) [Variable]
The smallest/largest possible small integer.
MIN.FIXP(MIN.FIXP (Variable) NIL NIL ("7") 4) [Variable]
MAX.FIXP(MAX.FIXP (Variable) NIL NIL ("7") 4) [Variable]
The smallest/largest possible large integer.
MIN.INTEGER(MIN.INTEGER (Variable) NIL NIL ("7") 4) [Variable]
MAX.INTEGER(MAX.INTEGER (Variable) NIL NIL ("7") 4) [Variable]
The value of MAX.INTEGER and MIN.INTEGER are two special system datatypes. For some algorithms, it is useful to have an integer that is larger than any other integer. Therefore, the values of MAX.INTEGER and MIN.INTEGER are two special data types; the value of MAX.INTEGER is GREATERP than any other integer, and the value of MIN.INTEGER is LESSP than any other integer. Trying to do arithmetic using these special bignums, other than comparison, will cause an error.
All of the functions described below work on integers. Unless specified otherwise, if given a floating-point number, they first convert the number to an integer by truncating the fractional bits, e.g., (IPLUS 2.3 3.8) = 5; if given a non-numeric argument, they generate an error, Non-numeric arg.
(IPLUS X1 X2 ... XN) [NoSpread Function]
Returns the sum X1 + X2 + ... + XN. (IPLUS) = 0.
(IMINUS X) [Function]
-X
(IDIFFERENCE X Y) [Function]
X - Y
(ADD1(ADD1 (Function) NIL NIL ("7") 5) X) [Function]
X + 1
(SUB1(SUB1 (Function) NIL NIL ("7") 5) X) [Function]
X - 1
(ITIMES(ITIMES (Function) NIL NIL ("7") 5) X1 X2 ... XN) [NoSpread Function]
Returns the product X1 * X2 * ... * XN. (ITIMES) = 1.
(IQUOTIENT(IQUOTIENT (Function) NIL NIL ("7") 5) X Y) [Function]
X / Y truncated. Examples:
(IQUOTIENT 3 2) => 1
(IQUOTIENT -3 2) => -1
If Y is zero, the result is determined by the function OVERFLOW .
(IREMAINDER(IREMAINDER (Function) NIL NIL ("7") 5) X Y) [Function]
Returns the remainder when X is divided by Y. Example:
(IREMAINDER 5 2) => 1
(IMOD(IMOD (Function) NIL NIL ("7") 5) X N) [Function]
Computes the integer modulus of X mod N; this differs from IREMAINDER in that the result is always a non-negative integer in the range [0,N).
(IGREATERP(IGREATERP (Function) NIL NIL ("7") 5) X Y) [Function]
T, if X > Y; NIL otherwise.
(ILESSP(ILESSP (Function) NIL NIL ("7") 5) X Y) [Function]
T, if X < Y; NIL otherwise.
(IGEQ(IGEQ (Function) NIL NIL ("7") 5) X Y) [Function]
T, if X >= Y; NIL otherwise.
(ILEQ(ILEQ (Function) NIL NIL ("7") 5) X Y) [Function]
T, if X <= Y; NIL otherwise.
(IMIN(IMIN (Function) NIL NIL ("7") 5) X1 X2 ... XN) [NoSpread Function]
Returns the minimum of X1, X2, ..., XN. (IMIN) returns the largest possible large integer, the value of MAX.INTEGER.
(IMAX(IMAX (Function) NIL NIL ("7") 5) X1 X2 ... XN) [NoSpread Function]
Returns the maximum of X1, X2, ..., XN. (IMAX) returns the smallest possible large integer, the value of MIN.INTEGER.
(IEQP(EQP (Function) NIL NIL ("7") 6) X Y) [Function]
Returns T if X and Y are equal integers; NIL otherwise. Note that EQ may be used if X and Y are known to be small integers. IEQP converts X and Y to integers, e.g., (IEQP 2000 2000.3) => T.
(FIX(FIX (Function) NIL NIL ("7") 6) N) [Function]
If N is an integer, returns N. Otherwise, converts N to an integer by truncating fractional bits For example, (FIX 2.3) => 2, (FIX -1.7) => -1.
Since FIX is also a programmer's assistant command (see Chapter 13), typing FIX directly to a Medley executive will not cause the function FIX to be called.
(FIXR(FIXR (Function) NIL NIL ("7") 6) N) [Function]
If N is an integer, returns N. Otherwise, converts N to an integer by rounding. FIXR will round towards the even number if N is exactly half way between two integers. For example, (FIXR 2.3) => 2, (FIXR -1.7) => -2, (FIXR 3.5) => 4).
(GCD(GCD (Function) NIL NIL ("7") 6) N1 N2) [Function]
Returns the greatest common divisor of N1 and N2, (GCD 72 64)=8.
Logical Arithmetic(ARITHMETIC NIL Arithmetic NIL ("7") 6 SUBNAME LOGICAL% FUNCTIONS SUBTEXT logical% functions) Functions(LOGICAL% ARITHMETIC% FUNCTIONS NIL Logical% arithmetic% functions NIL ("7") 6)
1
(LOGAND(LOGAND (Function) NIL NIL ("7") 6) X1 X2 ... XN) [NoSpread Function]
Returns the logical AND of all its arguments, as an integer. Example:
(LOGAND 7 5 6) => 4
(LOGOR(LOGOR (Function) NIL NIL ("7") 6) X1 X2 ... XN) [NoSpread Function]
Returns the logical OR of all its arguments, as an integer. Example:
(LOGOR 1 3 9) => 11
(LOGXOR(LOGXOR (Function) NIL NIL ("7") 6) X1 X2 ... XN) [NoSpread Function]
Returns the logical exclusive OR of its arguments, as an integer. Example:
(LOGXOR 11 5) => 14
(LOGXOR 11 5 9) = (LOGXOR 14 9) => 7
(LSH(LSH (Function) NIL NIL ("7") 6) X N) [Function]
(Arithmetic) ªLeft Shift.º Returns X shifted left N places, with the sign bit unaffected. X can be positive or negative. If N is negative, X is shifted right -N places.
(RSH(RSH (Function) NIL NIL ("7") 6) X N) [Function]
(Arithmetic) ªRight Shift.º Returns X shifted right N places, with the sign bit unaffected, and copies of the sign bit shifted into the leftmost bit. X can be positive or negative. If N is negative, X is shifted left -N places.
Warning: Be careful if using RSH to simulate division; RSHing a negative number isn't the same as dividing by a power of two.
(LLSH(LLSH (Function) NIL NIL ("7") 7) X N) [Function]
(LRSH(LLSH (Function) NIL NIL ("7") 7) X N) [Function]
ªLogical Left Shiftº and ªLogical Right Shiftº. The difference between a logical and arithmetic right shift lies in the treatment of the sign bit. Logical shifting treats it just like any other bit; arithmetic shifting will not change it, and will ªpropagateº rightward when actually shifting rightwards. Note that shifting (arithmetic) a negative number ªall the wayº to the right yields -1, not 0.
Note: LLSH and LRSH always operate mod-232 arithmetic. Passing a bignum to either of these will cause an error. LRSH of negative numbers will shift 0s into the high bits.
(INTEGERLENGTH(LLSH (Function) NIL NIL ("7") 7) X) [Function]
Returns the number of bits needed to represent X. This is equivalent to: 1+floor[log2[abs[X]]]. (INTEGERLENGTH 0) = 0.
(POWEROFTWOP(POWEROFTWOP (Function) NIL NIL ("7") 7) X) [Function]
Returns non-NIL if X (coerced to an integer) is a power of two.
(EVENP(EVENP (Function) NIL NIL ("7") 7) X Y) [NoSpread Function]
If Y is not given, equivalent to (ZEROP (IMOD X 2)); otherwise equivalent to (ZEROP (IMOD X Y)).
(ODDP(ODDP (Function) NIL NIL ("7") 7) N MODULUS) [NoSpread Function]
Equivalent to (NOT (EVENP N MODULUS)). MODULUS defaults to 2.
(LOGNOT (LOGNOT% (Macro) NIL NIL ("7") 7)N) [Macro]
Logical negation of the bits in N. Equivalent to (LOGXOR N -1).
(BITTEST(BITTEST (Macro) NIL NIL ("7") 7) N MASK) [Macro]
Returns T if any of the bits in MASK are on in the number N. Equivalent to (NOT (ZEROP (LOGAND N MASK))).
(BITCLEAR(BITCLEAR (Macro) NIL NIL ("7") 7) N MASK) [Macro]
Turns off bits from MASK in N. Equivalent to (LOGAND N (LOGNOT MASK)).
(BITSET(BITSET (Macro) NIL NIL ("7") 7) N MASK) [Macro]
Turns on the bits from MASK in N. Equivalent to (LOGOR N MASK).
(MASK.1'S(MASK.1'S (Macro) NIL NIL ("7") 7) POSITION SIZE) [Macro]
Returns a bit-mask with SIZE one-bits starting with the bit at POSITION. Equivalent to (LLSH (SUB1 (EXPT 2 SIZE)) POSITION).
(MASK.0'S(MASK.0'S (Macro) NIL NIL ("7") 8) POSITION SIZE) [Macro]
Returns a bit-mask with all one bits, except for SIZE bits starting at POSITION. Equivalent to (LOGNOT (MASK.1'S POSITION SIZE)).
(LOADBYTE(LOADBYTE (Function) NIL NIL ("7") 8) N POS SIZE) [Function]
Extracts SIZE bits from N, starting at position POS. Equivalent to (LOGAND (RSH N POS) (MASK.1'S 0 SIZE)).
(DEPOSITBYTE(DEPOSITBYTE (Function) NIL NIL ("7") 8) N POS SIZE VAL) [Function]
Insert SIZE bits of VAL at position POS into N, returning the result. Equivalent to
(LOGOR (BITCLEAR N (MASK.1'S POS SIZE))
(LSH (LOGAND VAL (MASK.1'S 0 SIZE))
POS))
(ROT(ROT (Function) NIL NIL ("7") 8) X N FIELDSIZE) [Function]
ªRotate bits in fieldº. It performs a bitwise left-rotation of the integer X, by N places, within a field of FIELDSIZE bits wide. Bits being shifted out of the position selected by (EXPT 2 (SUB1 FIELDSIZE)) will flow into the ªunitsº position.
The notions of position and size can be combined to make up a ªbyte specifierº, which is constructed by the macro BYTE [note reversal of arguments as compared with the above functions]:
(BYTE(BYTE (Macro) NIL NIL ("7") 8) SIZE POSITION) [Macro]
Constructs and returns a ªbyte specifierº containing SIZE and POSITION.
(BYTESIZE(BYTESIZE (Macro) NIL NIL ("7") 8) BYTESPEC) [Macro]
Returns the SIZE componant of the ªbyte specifierº BYTESPEC.
(BYTEPOSITION(BYTEPOSITION (Macro) NIL NIL ("7") 8) BYTESPEC) [Macro]
Returns the POSITION componant of the ªbyte specifierº BYTESPEC.
(LDB(LDB (Macro) NIL NIL ("7") 8) BYTESPEC VAL) [Macro]
Equivalent to
(LOADBYTE VAL (BYTEPOSITION BYTESPEC)(BYTESIZE BYTESPEC))
(DPB(DPB (Macro) NIL NIL ("7") 8) N BYTESPEC VAL) [Macro]
Equivalent to
(DEPOSITBYTE VAL (BYTEPOSITION BYTESPEC)(BYTESIZE BYTESPEC) N)
Floating-Point Arithmetic(ARITHMETIC NIL Arithmetic NIL ("7") 8 SUBNAME FLOATING% POINT SUBTEXT floating% point)(FLOATING% POINT% ARITHMETIC NIL Floating% point% arithmetic NIL ("7") 8)
1
A floating-point number is input as a signed integer, followed by a decimal point, and another sequence of digits called the fraction, followed by an exponent (represented by E followed by a signed integer) and terminated by a delimiter.
Both signs are optional, and either the fraction following the decimal point, or the integer preceding the decimal point may be omitted. One or the other of the decimal point or exponent may also be omitted, but at least one of them must be present to distinguish a floating-point number from an integer. For example, the following will be recognized as floating-point numbers:
5. 5.00 5.01 .3
5E2 5.1E2 5E-3 -5.2E+6
Floating-point numbers are printed using the format control specified by the function FLTFMT (see Chapter 25). FLTFMT is initialized to T, or free format. For example, the above floating-point numbers would be printed free format as:
5.0 5.0 5.01 .3
500.0 510.0 .005 -5.2E6
Floating-point numbers are created by the reader when a ª.º or an E appears in a number, e.g., 1000 is an integer, 1000. a floating-point number, as are 1E3 and 1.E3. Note that 1000D, 1000F, and 1E3D are perfectly legal literal atoms. Floating-point numbers are also created by PACK and MKATOM, and as a result of arithmetic operations.
PRINTNUM (see Chapter 25) permits greater control over the printed appearance of floating-point numbers, allowing such things as left-justification, suppression of trailing decimals, etc.
The floating-point number range is stored in the following variables:
MIN.FLOAT(MIN.FLOAT (Variable) NIL NIL ("7") 9) [Variable]
The smallest possible floating-point number.
MAX.FLOAT(MAX.FLOAT (Variable) NIL NIL ("7") 9) [Variable]
The largest possible floating-point number.
All of the functions described below work on floating-point numbers. Unless specified otherwise, if given an integer, they first convert the number to a floating-point number, e.g., (FPLUS 1 2.3) <=> (FPLUS 1.0 2.3) => 3.3; if given a non-numeric argument, they generate an error, Non-numeric arg.
(FPLUS(FPLUS (Function) NIL NIL ("7") 9) X1 X2 ... XN) [NoSpread Function]
X1 + X2 + ... + XN
(FMINUS(FMINUS (Function) NIL NIL ("7") 9) X) [Function]
- X
(FDIFFERENCE(FDIFFERENCE (Function) NIL NIL ("7") 9) X Y) [Function]
X - Y
(FTIMES(FTIMES (Function) NIL NIL ("7") 9) X1 X2 ... XN) [NoSpread Function]
X1 * X2 * ... * XN
(FQUOTIENT(FQUOTIENT (Function) NIL NIL ("7") 10) X Y) [Function]
X / Y.
The results of division by zero and floating-point overflow is determined by the function OVERFLOW.
(FREMAINDER(FREMAINDER (Function) NIL NIL ("7") 10) X Y) [Function]
Returns the remainder when X is divided by Y. Equivalent to:
(FDIFFERENCE X (FTIMES Y (FIX (FQUOTIENT X Y))))
Example:
(FREMAINDER 7.5 2.3) => 0.6
(FGREATERP(FGREATERP (Function) NIL NIL ("7") 10) X Y) [Function]
T, if X > Y, NIL otherwise.
(FLESSP(FLESSP (Function) NIL NIL ("7") 10) X Y) [Function]
T, if X < Y, NIL otherwise.
(FEQP(FEQP (Function) NIL NIL ("7") 10) X Y) [Function]
Returns T if X and Y are equal floating-point numbers; NIL otherwise. FEQP converts X and Y to floating-point numbers.
(FMIN(FMIN (Function) NIL NIL ("7") 10) X1 X2 ... XN) [NoSpread Function]
Returns the minimum of X1, X2, ..., XN. (FMIN) returns the largest possible floating-point number, the value of MAX.FLOAT.
(FMAX(FMAX (Function) NIL NIL ("7") 10) X1 X2 ... XN) [NoSpread Function]
Returns the maximum of X1, X2, ..., XN. (FMAX) returns the smallest possible floating-point number, the value of MIN.FLOAT.
(FLOAT(FLOAT (Function) NIL NIL ("7") 10) X) [Function]
Converts X to a floating-point number. Example:
(FLOAT 0) => 0.0
Transcendental Arithmetic Functions
1
(EXPT(EXPT (Function) NIL NIL ("7") 10) A N) [Function]
Returns AN. If A is an integer and N is a positive integer, returns an integer, e.g, (EXPT 3 4) => 81, otherwise returns a floating-point number. If A is negative and N fractional, generates the error, Illegal exponentiation. If N is floating and either too large or too small, generates the error, Value out of range expt.
(SQRT(SQRT (Function) NIL NIL ("7") 11) N) [Function]
Returns the square root of N as a floating-point number. N may be fixed or floating-point. Generates an error if N is negative.
(LOG(LOG (Function) NIL NIL ("7") 11) X) [Function]
Returns the natural logarithm of X as a floating-point number. X can be integer or floating-point.
(ANTILOG(ANTILOG (Function) NIL NIL ("7") 11) X) [Function]
Returns the floating-point number whose logarithm is X. X can be integer or floating-point. Example:
(ANTILOG 1) = e => 2.71828...
(SIN(SIN (Function) NIL NIL ("7") 11) X RADIANSFLG) [Function]
Returns the sine of X as a floating-point number. X is in degrees unless RADIANSFLG = T.
(COS(COS (Function) NIL NIL ("7") 11) X RADIANSFLG) [Function]
Similar to SIN.
((TAN (Function) NIL NIL ("7") 11)TAN X RADIANSFLG) [Function]
Similar to SIN.
(ARCSIN (ARCSIN% (Function) NIL NIL ("7") 11)X RADIANSFLG) [Function]
The value of ARCSIN is a floating-point number, and is in degrees unless RADIANSFLG = T. In other words, if (ARCSIN X RADIANSFLG) = Z then (SIN Z RADIANSFLG) = X. The range of the value of ARCSIN is -90 to +90 for degrees, -ÿÿ&sÿ/2 to ÿÿ&sÿ/2 for radians. X must be a number between -1 and 1.
(ARCCOS(ARCCOS (Function) NIL NIL ("7") 11) X RADIANSFLG) [Function]
Similar to ARCSIN. Range is 0 to 180, 0 to ÿÿ&sÿ.
(ARCTAN(ARCTAN (Function) NIL NIL ("7") 11) X RADIANSFLG) [Function]
Similar to ARCSIN. Range is 0 to 180, 0 to ÿÿ&sÿ.
(ARCTAN2(ARCTAN2 (Function) NIL NIL ("7") 11) Y X RADIANSFLG) [Function]
Computes (ARCTAN (FQUOTIENT Y X) RADIANSFLG), and returns a corresponding value in the range -180 to 180 (or -ÿÿ&sÿ to ÿÿ&sÿ), i.e. the result is in the proper quadrant as determined by the signs of X and Y.
Generating Random Numbers
1
(RAND(RAND (Function) NIL NIL ("7") 11) LOWER UPPER) [Function]
Returns a pseudo-random number between LOWER and UPPER inclusive, i.e., RAND can be used to generate a sequence of random numbers. If both limits are integers, the value of RAND is an integer, otherwise it is a floating-point number. The algorithm is completely deterministic, i.e., given the same initial state, RAND produces the same sequence of values. The internal state of RAND is initialized using the function RANDSET.
(RANDSET(RANDSET (Function) NIL NIL ("7") 12) X) [Function]
Returns the internal state of RAND. If X = NIL, just returns the current state. If X = T, RAND is initialized using the clocks, and RANDSET returns the new state. Otherwise, X is interpreted as a previous internal state, i.e., a value of RANDSET, and is used to reset RAND. For example,
¬(SETQ OLDSTATE (RANDSET))
...
¬(for X from 1 to 10 do (PRIN1 (RAND 1 10)))
2847592748NIL
¬(RANDSET OLDSTATE)
...
¬(for X from 1 to 10 do (PRIN1 (RAND 1 10)))
2847592748NIL
[This page intentionally left blank]
(LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 9 FAMILY TIMESROMAN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (222 24 288 36) NIL) (TEXT NIL NIL (54 36 408 540) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD LEFT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 9 FAMILY TIMESROMAN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (102 24 288 36) NIL) (HEADING NIL (HEADINGTYPE LEFTBACK) (96 612 516 36) NIL) (TEXT NIL NIL (102 36 456 540) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC "7-" "")) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD RIGHT) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 9 FAMILY TIMESROMAN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC "7-" "")) (222 24 288 36) NIL) (HEADING NIL (HEADINGTYPE RIGHTPAGE) (48 612 564 36) NIL) (TEXT NIL NIL (54 36 408 540) NIL))))),l~°,rr°30`°°T30`°°T,HH°1°äìEVENT-°T@È PAGEHEADING RIGHTPAGE0È
T,l~°,ll°,l~°60`°`°T5H°BH5H°BH5H°BH,°/ÈAÈ PAGEHEADING RIGHTPAGET,°@È PAGEHEADINGLEFTBACKT,HH°TITANTITANÿþ
TIMESROMAN
PALATINO PALATINO PALATINOPALATINO  HELVETICA TITAN TITAN TITAN CLASSIC
CLASSIC
CLASSIC
MODERN
MODERNMODERN
!
IM.CHAP.GETFNMODERN
% HRULE.GETFNMODERN)!IM.INDEX.GETFNQIM.INDEX.GETFNQIM.INDEX.GETFN#AIM.INDEX.GETFNOIM.INDEX.GETFNÔ
¦/IM.INDEX.GETFNS
 #IM.INDEX.GETFNTITAN  
  
+ 
 !IM.INDEX.GETFNTITAN  
  

Y 
 #IM.INDEX.GETFNTITAN  
  
' 
 $IM.INDEX.GETFNTITAN  
  
+ 

 
 J

I3
!
L



 IM.INDEX.GETFNTITAN    

  

  "
  
N

  
il
 %IM.INDEX.GETFNTITAN  
 
+ 

ž# 
I 

ˆ

J 9IM.INDEX.GETFNGIM.INDEX.GETFN HRULE.GETFN¼
]

 !IM.INDEX.GETFNTITAN 
   
 
 
 
 "IM.INDEX.GETFNTITAN 
 

 
'IM.INDEX.GETFNTITAN 
 
  
"IM.INDEX.GETFN 
   
 
 
 
 
 %IM.INDEX.GETFNTITAN 
 
  4    @
&IM.INDEX.GETFNTITAN    
  
 
 


 
 

 'IM.INDEX.GETFN   

 
 

 "IM.INDEX.GETFNMODERN
   

 
 

 IM.INDEX.GETFNMODERN
   

 
 

 IM.INDEX.GETFNCLASSIC
   

 
 

 "IM.INDEX.GETFNMODERN
 
 

 


 #IM.INDEX.GETFNMODERN
 

 
?
 IM.INDEX.GETFNMODERN
    
  
  
 

-
 IM.INDEX.GETFNMODERN
    
  
   

-
 IM.INDEX.GETFNCLASSIC
 
  

 




 GIM.INDEX.GETFN9IM.INDEX.GETFN HRULE.GETFN

)
/
<
<
<
<
B
H

8


Å5

Z
:

U
CŒ
'IM.INDEX.GETFNTITAN 
'IM.INDEX.GETFNTITAN - %IM.INDEX.GETFNTITAN  %IM.INDEX.GETFNTITAN - (IM.INDEX.GETFNTITAN  (IM.INDEX.GETFNTITAN 


š

*

*

zË
;

     
  
 
 
 

   

 
    
 
 
 !IM.INDEX.GETFNTITAN   
 

 !IM.INDEX.GETFNTITAN   
 

 #IM.INDEX.GETFNTITAN      
  
 
 
 

&IM.INDEX.GETFNTITAN    
 
  


 3

'IM.INDEX.GETFNTITAN    
   

 !IM.INDEX.GETFNTITAN    
   
E 
&IM.INDEX.GETFNTITAN    

 
 

 #IM.INDEX.GETFNTITAN    

 
 

 !IM.INDEX.GETFNCLASSIC
   

 
 

 !IM.INDEX.GETFNTITAN    

 
 

 !IM.INDEX.GETFNTITAN     
  
  
 
:

 !IM.INDEX.GETFNTITAN     
  
  
 
;

 IM.INDEX.GETFNTITAN    

  

  "
  


 IM.INDEX.GETFNTITAN  
   ;


C
<

 !IM.INDEX.GETFNTITAN  
   
' 9



 IM.INDEX.GETFNTITAN    
'  
 ]IM.INDEX.GETFN
OIM.INDEX.GETFN HRULE.GETFN
 #IM.INDEX.GETFNTITAN     
  

0 

 "IM.INDEX.GETFNTITAN     
  

0 

 #IM.INDEX.GETFNTITAN     
  

, 

'

 IM.INDEX.GETFNTITAN    
$  ( "  
 
 IM.INDEX.GETFNTITAN    
%  b "   

D
 !IM.INDEX.GETFNTITAN    

 !IM.INDEX.GETFNTITAN    
ˆ



G
7
!IM.INDEX.GETFNTITAN  
/ 
 



(IM.INDEX.GETFNTITAN  
 
 ,
 "IM.INDEX.GETFNTITAN    
 
 


 !IM.INDEX.GETFNTITAN    

 
 "IM.INDEX.GETFN 
  
 

 !IM.INDEX.GETFNTITAN    

  
  

 "IM.INDEX.GETFNTITAN    
  
 
 

 IM.INDEX.GETFNTITAN    
  
 
 

 "IM.INDEX.GETFNTITAN    
 # 
 
 

 "IM.INDEX.GETFNTITAN    
1  
  

 %IM.INDEX.GETFNTITAN      
    

 


 

(IM.INDEX.GETFNTITAN        
 
  ' 

 
 



 

 

 IM.INDEX.GETFNTITAN     
K   @

&r
D
 IM.INDEX.GETFNTITAN    
5  
 "IM.INDEX.GETFNTITAN  
 
# 
&IM.INDEX.GETFNTITAN  
 
# 
 IM.INDEX.GETFNTITAN    

 

 

 IM.INDEX.GETFNTITAN      

 

 
 
 WIM.INDEX.GETFNIIM.INDEX.GETFN HRULE.GETFN¯
>| 

V


b 
 
8



!




P

,
´F &IM.INDEX.GETFNTITAN - &IM.INDEX.GETFNTITAN ,)
;

 "IM.INDEX.GETFNTITAN     
  
 
 
 
 #IM.INDEX.GETFNTITAN  

 
(IM.INDEX.GETFNTITAN    
 
 
 #IM.INDEX.GETFNTITAN     
  
 
 
 
'IM.INDEX.GETFNTITAN    
 
 Z

(IM.INDEX.GETFNTITAN    
  

 
 
 
  

'IM.INDEX.GETFNTITAN    

 
 

 $IM.INDEX.GETFNTITAN    

 
 

 "IM.INDEX.GETFNTITAN    

  #

  
 "IM.INDEX.GETFNTITAN     
  
  
 
B

 "IM.INDEX.GETFNTITAN     
  
  
 
C

 #IM.INDEX.GETFNTITAN  
  ' 
 # HRULE.GETFN
 "IM.INDEX.GETFNTITAN    
   1
1  "
 E

 "IM.INDEX.GETFNTITAN  
  8 
 !IM.INDEX.GETFNTITAN  
!  #
 %IM.INDEX.GETFNTITAN  
5  - 

 !IM.INDEX.GETFNMODERN
 

  


 !IM.INDEX.GETFNMODERN
 

 

!IM.INDEX.GETFN  

 

 &IM.INDEX.GETFN 



6





 



 &
 $IM.INDEX.GETFNTITAN  

 




 $IM.INDEX.GETFNTITAN  

 




 %IM.INDEX.GETFNTITAN    

 
  


1





M    HRULE.GETFN
 "IM.INDEX.GETFNTITAN     
'  
b

>
#

 %IM.INDEX.GETFNTITAN  

 
& 

&
$ ?

 

-



-

%b• czº