EasyManua.ls Logo

Radio Shack TRS-80 - Page 74

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...
90 L
= INT
(Z)
100
PRINT
"L
="
;L
... and RUN.
Nope
that's
a sure loser. We got
0.
The
integer value of .141589
was that value
rounded
down
to the next number, and
the
next number down was zero. Hmmm! Erase out lines
90 and
100
and
let's
try
again. Got any better ideas? No?
Well, think
some more.
•$
f
(. .
,
brief
interlude
of recorded
music .
.
.)
.
Right!
If we
multiply
the value of Z by
10
then Z will
become
a whole
number
plus
a
decimal part:
1.41589. We can then take its integer value and
strip
off the
decimal
part,
leaving
the left hand
digit
standing
alone. Let's
label the left-hand digit L and see what
happens. Enter:
90 M
=
Z
*
10
100
L
=
INT (M)
1 10 PRINT "L
=
" ;L
...
and RUN.
Now, that's more like it. It reads:
X
=
3. 14159
Y
=
3
Z
=
.
141589
L
=
1
We peeled off the leftmost digit in the decimal. Can you think of any way we might use a
FOR-NEXT loop in
order
to strip
off
some
more?
(,
,
. More recorded music . .
.)
•fr
72
Time out
for
creative thinking!
After
all, these
digits
might
not he
fust
a more
accurate value
of
pi,
but a
coded
message
from
a
-\
cereal box.
if
you don
't have the
decoder ring it
's
tough
luck,
Charlie -unten
ym.haye.
M-c'c^puterl}.,

Other manuals for Radio Shack TRS-80

Related product manuals