A!
=
-1234
Stores - 1234.000
in
A!.
Double
to
sing
Ie
precision
This involves converting a number with
up
to
16
significant digits into
a number with
no
more than seven digits. BASIC rounds the number
to seven significant digits. Before printing
it,
BASIC rounds it off to six
digits.
Examples
A!
=
1.234587880124587
stores 1.234568
in
A!.
However, the statement:
PRINT
A
displays the value 1.23457, because only six digits are displayed. The
full seven digits are stored
in
memory.
A I =
1.3333333333333333
stores 1.333333
in
A!.
Single
to
double
precision
To make this conversion, BASIC simply adds trailing zeros to the
single-precision number.
If
the original value has
an
exact binary
representation
in
single-precision format,
no
error is introduced. For
example:
A#
=
1.5
stores 1.5000000000000
in
A#,
since 1.5 does have
an
exact binary
representation.
However, for numbers which have
no
exact binary representation,
an
error is introduced when zeros are added. For example:
A#
=
1.
3
stores 1.299999952316284
in
A#.
Because most fractional numbers do not have
an
exact binary
representation, you should keep such conversions out of your
programs. For example, whenever you assign a constant value to a
double-precision variable,
you
can force the constant to be double
precision:
A# =
1.3#
A#
=
1.30
both store 1.3
in
A#.
Here
is
a special technique for converting a single precision value to
double precision, without introducing
an
error into the double-precision
2-37