BUG: Zero to Zero Power Returns Bad Result If Compiled w/68881 (65942)



The information in this article applies to:

  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0
  • Microsoft QuickBASIC Compiler for the Apple Macintosh 1.0a

This article was previously published under Q65942

SYMPTOMS

If a program is compiled with the "Generate 68881 Code" option under QuickBasic (b) (binary math version) and it attempts to raise 0 (zero) to the power of 0 (zero), the program will return 0 (zero) instead of the correct answer, which is 1.

Microsoft has confirmed this to be a bug with Microsoft QuickBasic versions 1.00 and 1.00a for Macintosh systems. We are researching this problem and will post new information here as it becomes available.

MORE INFORMATION

If the sample program below is compiled with the "Generate 68881 Code" option (from the Options command in the Run menu of QuickBasic binary math version), the program will return an erroneous result (0). If the program is run inside the QuickBasic interpreter environment, the program runs properly and the correct result is 1.

The program fails only under the two conditions shown below, where X=0 and Y=0:
   Y ^ X    or    0 ^ X
				
Note that the expression 0^0 works correctly.

Sample Code

X= 0
Y= 0
PRINT "Y^X ",Y ^ X   'Zero raised to the power of zero gives problem.
PRINT "0^X ",0 ^ X   'This form also produces the problem.
PRINT "0^0 ",0 ^ 0   'This works.
WHILE INKEY$ = "" : WEND
END
				

Modification Type:MajorLast Reviewed:10/20/2003
Keywords:kbbug KB65942