Microsoft KB Archive/35516
Article ID: 35516
Article Last Modified on 1/8/2003
- Microsoft QuickBasic Compiler for Macintosh 1.0
This article was previously published under Q35516
In programs compiled with Microsoft QuickBasic (b) (binary math) Version 1.00, a constant that is the object of the exponential operator (^) does not assume double precision when assigned to a double-precision variable. As a result, the exponential calculation is only accurate to single precision.
To work around the problem, you can append an explicit type symbol of &, #, or ! onto the exponential constant, as shown below, or compile with Microsoft QuickBasic (d) (decimal math). The problem does not exist in the interpreter or in the Microsoft Basic Compiler Version 1.00 for the Macintosh .
Microsoft has confirmed this to be a bug in the Microsoft QuickBasic Compiler (b) Version 1.00 for the Macintosh . We are researching this problem and will post new information as it becomes available.
The following program correctly returns 1.52399025D-20 in the interpreter but gives 1.52399094076451D-20 when compiled, which is only accurate to single precision. However, if an exponent of 2&, 2#, or 2! is used, the compiled program correctly returns 1.52399025D-20, which is accurate to double precision.
DEFDBL a-z i = .00000000012345# PRINT i^2 REM As a workaround, you may use PRINT i^2#
Additional query words: MQuickB
Keywords: kbbug KB35516