"Division by zero" on Coprocessor on COS, SIN, ^ Can Hang QBX (75172)






This article was previously published under Q75172

SYMPTOMS

If your computer has a math coprocessor and a "Division by zero" error occurs with floating point numbers during the operation of a transcendental math function, the QBX.EXE environment can hang. This behavior does not occur in programs that have been compiled with BC.EXE.

STATUS

Microsoft has confirmed this to be a bug in the QBX.EXE environment of Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1. Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following code sample demonstrates the problem:
   PRINT COS(.1 / 0)      'Same behavior for SIN, TAN, ATN
				
After you run the above line of code inside QBX.EXE, a "Division by zero" error correctly occurs. After you dismiss the error message by pressing ESC or clicking on OK, the cursor fails to appear in QBX.EXE and you cannot edit the program. Also, the Immediate window changes color to black, but the pull-down menus can still be operated with the mouse, function keys (such as F5), or access keys (such as ALT+F). At this point, QBX.EXE can hang if you do not exit the environment. If you run the code again by pressing F5, the borders disappear completely from the QBX.EXE environment.

The transcendental math functions are the trigonometric functions (SIN, COS, TAN, ATN) and the exponential operator (^). Some other examples of transcendental math functions that cause a problem are as follows:
   PRINT (2.1 / 0) ^ 2
 
   PRINT 1 ^ (1.2 / 0)
				
Note that the problem will only occur on computers with a math coprocessor (such as a 8087, 80287, or 80387 chip) when you use floating point numbers. The problem will not occur if the number being divided is not a floating point number (for example, if you use 2 and 1 in the above examples instead of 2.1 and 1.2, respectively).

To work around this problem, you can use the MS-DOS command SET NO87=X to turn off the math coprocessor from MS-DOS before running the QBX.EXE environment. (To turn the coprocessor back on, use the MS-DOS command SET NO87=.)

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB75172