Radio Shack TRS-80 PC-3 Owner's Manual page 221

Table of Contents

Advertisement

7. Unary minus, negative sign (-)
8. Multiplication and division (*, I)
9. Addition and subtraction (+,-)
10. Relational operators
(<.
<=, =, <>, >=,
»
11. Logical operators (AND, OR)
The fourth item refers to usage such as 2A or 5C(2) in which a multiplication operator is implied, but not shown. The third refers
to the combination of this with exponentiation, such as 3A"3 or 5D" 1.5. In these combined cases the exponentiation will be
done first and the multiplication second.
When there are two or more operators at the same priority level, the expression will be evaluated from left to right. Note that
with A+B-C, for example, the answer is the same whether the addition or the subtraction is done first.
When an expression contains multiple nested parentheses, the innermost set is evaluated first and evaluation then proceeds outward.
Sample Evaluation
Starting with the expression:
((3+5-2)*6+2) I 10"LOG 100
The
PC-3
Computer would first evaluate the innermost set of parentheses. Since '+' and '-' are at the same level, it would move
from left to right and wou Id do the addition first:
( (8-2)
*
6+2)
I
10"LOG 100
Then it would do subtraction:
224

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents