COMTRAN Reconstruction

F28-8043 · June 1960

Page 45

PDF page 51 of 124. Download the scanned PDF

The page as scanned

The scan of PDF page 51 of F28-8043
Select the scan to open it at full size.

The text read off it

[page 45]

The second of these examples shows the way in which subexpressions may be contained in parentheses when required. Likewise, the examples taken together illustrate the use of each element which may appear in an arithmetic expression, viz., arithmetic operators, names of variables and constants, literals, truth functions, and function-names. Each of these elements is considered individually below even though it may be discussed in greater detail elsewhere in the manual. (The formal rules governing the formation of arithmetic expressions are given in Appendix 2.)

ARITHMETIC OPERATORS

The following arithmetic operators are used to join other elements to form meaningful arithmetic expressions:

Operator Written as
Addition +
Subtraction −
Multiplication *
Division /
Exponentiation **

These operators are sometimes referred to as "binary" operators because each of them relates two quantities. There are three additional arithmetic operators known as "unary" operators. They are:

Operator Written as
Negation −
Absolute value ABS
Truth value TR

These operators affect only the quantity or expression which follows, hence the term unary. If the operand of a unary operator is an expression it must be enclosed in parentheses, as in these examples:

... + ABS (A + B)
... * (−(ON.HAND + ON.ORDER))
... TR (A IS LESS THAN B)
VARIABLES AND CONSTANTS

Data-names which represent numeric variables or constants may appear anywhere in arithmetic expressions. Those which represent alphameric variables and constants , however, may appear only within truth functions.

LITERALS

Literals may be used as needed in arithmetic expressions. Literals used in the above examples of the SET command are 40 in the first example and 2 in the fifth.

TRUTH FUNCTIONS

A conditional expression enclosed in parentheses preceded by the truth operator TR is known as a truth function. A truth function always has one of two values, 1 or 0, depending on whether the conditional expression is true or false.