Beruflich Dokumente
Kultur Dokumente
Tags of the form [See m-n: ...] not part of the original document; they are
references (by section-page number in the original manual) to notes which
follow the appendix transcription. These notes are also excerpts from the
manual.
There is one correction in the text. The original manual listed both LN
and LOG as built-in functions and wrote "LOG(a)" is "natural log of a". We
believe this is incorrect; we have changed the "LOG(a)" in the original to
LN(a) and inserted a new "LOG(a)" entry. This implementation's LOG function
is, accordingly, log_10() and not log_e().
There are a few typographical changes to fit it into the ASCII character set.
The differences:
The combination of Appendix A and the notes includes essentially all the
manual's documentation of the CUPL language itself. We have not transcribed
appendix D, "Error Considerations and Actions", nor appendix B, "Functions",
because the former depends on the parsing machinery of the original compiler
and the latter documents range restrictions and precision constraints for the
special functions (which are not duplicated in our implementation).
The following .cupl files, included with this distribution, are also
transcribed from the manual. We include every non-pathological program
example. The following list maps programs to original page numbers:
We have supplied leading comments for most of these; they are otherwise
unaltered.
Summary of CUPL
Characters
----------
Letters: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Digits: 0 1 2 3 4 5 6 7 8 9
Special Characters: + - * / ( ) . , ' =
Numbers
-------
Normal decimal usage: e.g. 3, 1.725, -.06 .
"Scientific" notation: -1.2E-3 for -1.2 x 10^3 .
Truncated to 9 significant figures by the system.
Range: Absolute values from 10^-78 to 10^76, and 0 .
If A is a matrix variable:
If V is a vector variable:
Arithmetic Operators
--------------------
a. +, -, /, * for multiplication, ** for exponentiation
Spacing
-------
No spaces, or splitting at end of line, in any number,
variable, label, reserved word, or **. Spaes allowable
anywhere else.
Functions
---------
Form Action Type of Argument
---- ------ ----------------
ABS(a) absolute value of a any expression
ATAN(a) arctangent of a, in numerical valued
radians expression
COS(a) cosine of a, a in numerical valued
radians expression
EXP(e) e raised to a power numerical valued
expression
FLOOR(a) greatest integer not numerical valued
exceeding a expression
LN(a) natural log of a numerical valued
expression
LOG(a) log to base 10 of a numerical valued
expression
SQRT(a) positive square root numerical valued
of a expression
SIN(a) sine of a, a in numerical valued
radians expression
MAX(a,b,...) maximum value of all any expressions
elements of all
arguments
A-3
Relations
---------
Symbol With scalar expressions With array expressions
------ ----------------------- ----------------------
= equals all corresponding ele-
ments equal
NE not equal to at least one pair of
corr. ele. not equal
LE less than or equal to all corr. ele. less than
or equal
GE greater than or equal all corr. ele. greater
to than or equal
LT less than all corr. ele. less than
or equal; at least one
less than
GT greater than all corr. ele. greater
than or equal; at least
one greater than
STATEMENTS
Assignment Statement
--------------------
LET v1 = e1
STOP
PERFORM blabel1
WHILE e1 r1 e2 OR e3 r2 e4 OR ...
Communication Statements
------------------------
READ v1, v2, ... [See 5-2 and 9-2 for description]
1. Variable. Prints:
DATA
Other quotes:
From 4-12:
WRITE ALL
This will cause the values of all of the variables in the program to be
printed. There is no WATCH ALL statement.
--
From 5-2:
If the total data list is too short, the machine will give an error
message and will give the value 1 for each of the missing numbers. If the
list is too long the extra entries will be ignored but no error message will
be given.
From 5-3:
will put A and its value in fields 2 and 3, and the value of B in 6,
leaving fields 1, 4 and 5 vacant. The statement
WRITE
From 8-3:
and
WATCH v,...
Here v must be a non-subscripted variable. Also, WRITE ALL will print only
the values of the non-subscripted variables.
From 8-10:
1. A new line is started for each vector and each row of a matrix.
From 9-1:
Vectors as matrices
-------------------
Consideration of relations involving matrices and vectors can be
simplified by regarding a vector as a 1-column matrix. This convention is
adopted in CUPL, and so, for example
ALLOCATE X(7)
and
ALLOCATE X(7, 1)
have precisely the same meaning. After either of these allocations the
variables X(2) and X(2, 1) are meaningful and have the same value; X(M, N)
is meaningful only if N has the value 1.
From 9-2:
READ M(*, 3)
will read data into the third column of M, leaving the rest of M unchanged.
From 9-8:
From 11-3:
From 11-4: