Microsoft KB Archive/60862

= BUG: Probs Using Long Integers in Mac QuickBasic 1.00 =

Article ID: 60862

Article Last Modified on 11/21/2006



This article was previously published under Q60862



SYMPTOMS
This article documents several cases where the product of a long integer and another number can be incorrect in Microsoft QuickBasic Version 1.00 for the Macintosh. This problem occurs only in the interpreter, not in a compiled program.

Microsoft has confirmed this to be a bug in QuickBasic 1.00 for the Macintosh. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



MORE INFORMATION
To work around the problem, either compile the code or change one of the variables to a single- or a double-precision number. The table below summarizes the values that X and Y can take on in the code example and whether or not the expression fails.

Reproducing the problem only requires a three-line program with two variables. The data type of the two variables should be as described in the chart below. Consider the following three-line program: X =  Y =  PRINT X * Y This program produces incorrect results if X is a long integer with a value of 65536& and Y is a long integer with a value of -1. In this case, X will not be negative.

In the following chart

  &quot;MAX&quot; means the largest possible value that type of number can have.          MAX Long:   2,147,483,647 MAX Sing:  3.37+38 MAX Double: 1.67D+308   &quot;MIN&quot; means the smallest possible value that type of number can have.          MIN Long:   -2,147,483,648 MIN Sing:  -3.37E+38 MIN Double: -1.67D+308  &quot;Long&quot; means long-integer variable.  &quot;Sing&quot; means single-precision variable. Double means double-precision variable.              X                   Y              Problem ? ---         -

65536& to MAX Long  Negative Long          Yes

-65536& to MIN Long  Negative Long          Yes

65536& to MAX Long  Negative Integer       Yes

-65536& to MIN Long  Negative Integer       Yes

65536& to MAX Sing  Negative Long          No         or Double

-65536& to MIN Sing  Negative Long          No         or Double

65536& to MAX Long  Negative Sing          No                            or Double

-65536& to MIN Long  Negative Sing          No                            or Double </li></ol>

Additional query words: MQuickB

Keywords: kbbug KB60862

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.