FIX: Dividing 0 by 0 Returns Garbage Characters or Incorrect Numeric Value

ID: Q242467


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 6.0


SYMPTOMS

You perform a division where the divisor and dividend are both 0. The return value should be ******, but instead, a combination of ASCII characters or numerals and asterisks is returned. Additionally, if you perform such a calculation as a select item in a SQL SELECT statement, you might see an incorrect numeric return value.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

Steps to Reproduce Behavior

Simple Zero Division:
  1. Execute the following commands in the Command window:


  2. 
    lnX = 0/0
    ?lnX 
  3. Look at the return value printed to the desktop. Note that you see an underscore or hyphen, followed by several garbage characters, followed by a series of asterisks.


Zero Division in SQL SELECT Statement:
  1. Run the following code from a program (.PRG) file:


  2. 
    CREATE CURSOR c1 (f1 n(5), f2 n(5), f3 N(5), f4 N(5))
    INSERT INTO c1 VALUES (3,2,0,0)
    SELECT f1/f2 as q1, f4/f3 AS q2;
       FROM c1;
       INTO CURSOR c2
    BROWSE NOWAIT
    ?q2 
  3. The value appearing in the second column of the BROWSE window is -.5000*****.**. Note that the return value printed to the desktop is -0.5000.


(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Jim Saunders, Microsoft Corporation.

Additional query words:

Keywords : kbDatabase kbSQL kbVFp600 kbVFp600bug KbDBFDBC kbVS600sp3fix kbGrpFox kbDSupport
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: October 11, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.