EasyManua.ls Logo

Radio Shack TRS-80 - Page 75

Radio Shack TRS-80
236 pages
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...
Enough thinking there on company
time!
Enter
these
lines:
95
FOR
A
=
1 TO 6
120 M
=
M
-
L
130
M
=
M
*
10
140
NEXT
A
... and RUN.
Voila! (I never
did
figure
out what that
meant,
but I think it's positive.)
The "printout"
reads:
X
Y
Z
L
L
L
L
L
L
3.14159
3
. 141589
1
4
1
5
8
9
It's all
there.
Every digit, including the "squirrely"
ones from the land of
little
numbers, is
there.
Analyzing
the
program additions
(after
doing
a LIST)
:
Line 95 began a
FOR-NEXT loop with
6 passes, one for
each
of
the 6 digits right
of
the
decimal.
Line
120
creates
a new decimal value
of
M (just a temporary storage location)
by strip-
ping off
the integer
part.
(Plugging
in the values, M
=
1.41589
1
=
.41589)
Line
130
does the
same as line
90
did, multiplies the new decimal times
10
so as to make
the
left-hand
digit an integer and
vulnerable
to
being
snatched
away by the INT func-
tion. {M
=
.41589
*
10
=
4.1589)
Line
140
moves the
control back to
line
95 for another pass through
the clipping
program
. . .
and the
rest
is
history.
Is this too
hard
to follow?
No
it isn't
hard
to follow,
and you could go through and
indicate every
value
just like I
did and it would
be perfectly
clear
(to coin a phrase).
Let's instead
learn a way to let the
Computer help
us
understand
what it
is doing.
73

Other manuals for Radio Shack TRS-80

Related product manuals