EasyManua.ls Logo

Commodore VIC-20 - Page 84

Commodore VIC-20
404 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
70
The
VIC
20
User
Guide
Subtraction
(-).
The minus sign specifies that the operand on the right
of
the minus sign
is
to be subtracted from the operand on the left
of
the
minus sign.
For
example,
4-1
100--64
A-B
55-142
results in 3
results in
36
results in the variable
represented by label
B
being subtracted from the
variable represented
by
label A
results in
-87
The unary minus operator identifies a negative number.
For
example,
-5
-9E4
-B
4--2
Note
that
4
--
2
is
the
same as 4+2
Multiplication (*). An asterisk specifies that the operand on the right
of
the asterisk
is
to be multiplied by the operand on the left
of
the asterisk.
For
example,
100
* 2
50
* 0
A *
Xl
R% *
14
results in
200
results in 0
results in multiplication
of
two floating
point
numbers
represented by floating point
variables labeled A
and
Xl
results in
an
integer
represented
by
integer variable
label R% being multiplied by
14
In the examples above, if variable
.A
is
assigned the value 4.2 and
variable
Xl
is
assigned the value 9.63, then the answer would be 40.446. A
and
Xl
could hold integer values
100
and 2 to duplicate the first example;
however, the two numbers would
be
held in the floating point format as
100.0 and 2.0, since A and
Xl
are floating point variables. In order to
multiply
100
by
2,
representing these numbers as integers, the example
would have to be
A%
* Xl%.
Division
(/).
The slash specifies that the operand on the left ofthe slash
is
to be divided by the data (or operand) on the right
of
the slash.

Other manuals for Commodore VIC-20

Related product manuals