Chapter
51
Basic
Concepts
Numeric Constants
To change the way BASIC stores
a
numeric constant, add one of
the following symbols to the end
of
the number. If BASIC must
shorten a number to meet the new requirements, it rounds the
number.
!
declares
a
single precision number. For example, BASIC
stores the number 12.345678901234! as a single precision
number: 12.34568.
declares the number
a
single precision exponential number.
For example, BASIC stores the number 1.2E5
as
a single
precision number: 120000.
declares a double precision number.
For
example, BASIC
stores the number 1.5# as a double precision number: 1.5.
BASIC does not expand constants when declaring them dou-
ble precision.
declares the number a double precision exponential number.
For
example, BASIC stores the number 1.2D2 as a double
precision number: 120.
See the next section on converting numbers for important infor-
mation on converting from numbers to another precision.
-
E
#
D
Numeric Variables
BASIC initially classifies all numeric variables
as
single preci-
sion. You can declare variables
as
other than single precision in
2 ways:
Append
a
symbol to the variable name:
%
declares an integer variable. BASIC stores the value of
the variable
as
an integer. I%, FT%, and COUNTER%
are samples of integer-declared variables.
declares
a
single precision variable. BASIC stores the
value of the variable as
a
single precision number.
F!,
NM!, and BALANCE! are samples
of
variables declared
as
single precision.
!
48