Microsoft KB Archive/35516: Difference between revisions

From BetaArchive Wiki
(importing KB archive)
 
m (Text replacement - "&" to "&")
 
Line 46: Line 46:
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.<br />
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.<br />
<br />
<br />
To work around the problem, you can append an explicit type symbol of &amp;, #, 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 .<br />
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 .<br />
<br />
<br />
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.
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.
Line 55: Line 55:
== MORE INFORMATION ==
== MORE INFORMATION ==


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&amp;, 2#, or 2! is used, the compiled program correctly returns 1.52399025D-20, which is accurate to double precision.
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.
<pre class="codesample">DEFDBL a-z
<pre class="codesample">DEFDBL a-z
i = .00000000012345#
i = .00000000012345#

Latest revision as of 14:13, 21 July 2020

Knowledge Base


BUG: Binary QuickBasic Default Compiled Exponent (^) Bad

Article ID: 35516

Article Last Modified on 1/8/2003



APPLIES TO

  • Microsoft QuickBasic Compiler for Macintosh 1.0



This article was previously published under Q35516

SYMPTOMS

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.

MORE INFORMATION

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