EasyManua.ls Logo

Radio Shack TRS-80 Model III - Page 121

Radio Shack TRS-80 Model III
274 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...
BASIC
Take
the single-precision
variable,
convert it to a
string
with STRS,
then
convert the
resultant string back
into
a
number with
VAL.
That is, use:
VAL (STR$
(single-precision
variable))
For
example, the
following
program:
10 A!
=
1.3
20 A#
=
A!
30
PRINTA#
prints
a
value of:
1.299999952316284
Compare
with this program:
10A!
=
1.3
20A#
=
VAL(STR$(A!))
30
PRINT A#
which
prints
a
value of:
1.3
The
conversion
in line 20
causes the
value in
A! to be
stored
accurately in
double-precision
variable
A#.
Illegal
Conversions
BASIC
cannot
automatically
convert
numeric
values
to string, or
vice versa.
For
example,
the
statements:
A$=
1234
A%
=
"1234"
are
illegal. (Use STRS
and VAL
to
accomplish
such
conversions.)
111

Other manuals for Radio Shack TRS-80 Model III

Related product manuals