EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 166

Radio Shack TRS-80 Model 4
418 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...
value.
It
is
useful when the single-precision value is stored in a
variable.
Take the single-precision variable, convert it to a string with STR$,
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
PRINT
A#
prints a value of:
1.28888885231628a
Compare with this program:
10
A!
=
1.3
20 A# =
l)AL<
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$ =
123a
Ail,
=
"123a"
are illegal. They would return a "Type mismatch" error. (Use STR$
and VAL to accomplish such conversions.)
C-
How
BASIC
Manipulates Data
You have many fast methods you may use to get BASIC to count,
sort, test, and rearrange your data. These methods fall into two
categories:
1.
Operators
a.
numeric
b.
string
c.
relational
d.
logical
2.
Functions
2-38

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals