Garbage Assigning VAL or Single Precision to Double Precision (45421)
The information in this article applies to:
- Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
This article was previously published under Q45421 SUMMARY
In the interpreter in QuickBASIC (b) for Macintosh, assigning a
single-precision constant (directly or through the VAL function) to a
double-precision variable can give you extra garbage digits past the
seventh significant digit, while the same program gives no garbage
digits when compiled. This is not a software problem, but is the way
the binary math interpreter implements floating-point type conversion.
In binary math, to force constants that have a decimal point and seven
or fewer digits to higher precision, you must append a number sign (#)
character to the constant. Then, assigning that constant to a
double-precision variable will convert with double precision (up to 15
significant digits).
This information applies to the binary math versions of Microsoft
BASIC (b) Interpreter Versions 2.00, 2.10, and 3.00 and to Microsoft
QuickBASIC (b) Version 1.00 for the Apple Macintosh.
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | KB45421 |
---|
|