Commodore 128 Programmer's Reference Manual page 30

Hide thumbs Also See for 128:
Table of Contents

Advertisement

20
COMMODORE 128
EXAMPLES:
10/2
6400/4
A/B
4E2/XR
EXPONENTIATION (|)
The up arrow (|) specifies that the operand on the left is raised to the power specified
by the operand on the right (the exponent). If the operand on the right is a 2, the number
on the left is squared; if the exponent is a 3, the number on the left is cubed, etc. The
exponent can be any number as long as the result of the operation gives a valid
floating-point number.
EXAMPLES:
2 12
Equivalent to 2*2
3 f 3
Equivalent to 3*3*3
4 14
Equivalent to 4*4*4*4
AB | CD
3 f —2 Equivalent to 16* xh
RELATIONAL OPERATORS
The relational operators (<, = ,>,< = ,> = ,<>) are primarily used to compare the
values of two operands, but they also produce an arithmetic result. The relational
operators and the logical operators (AND, OR, and NOT), when used in comparisons,
produce an arithmetic true/false evaluation of an expression. If the relationship stated in
the expression is true, the result is assigned an integer value of-1. If it's false a value of
0 is assigned. Following are the relational operators:
<
LESS THAN
EQUAL TO
>
GREATER THAN
< =
LESS THAN OR EQUAL TO
> =
GREATER THAN OR EQUAL TO
NOT EQUAL TO
o
EXAMPLES:
5-4=1
result true (-1)
14>66
result false (0)
15> = 15
result true (-1)
Relational operators may be used to compare strings. For comparison purposes,
the letters of the alphabet have the order A<B<C<D, etc. Strings are compared by

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents