PRB: EMPTY() May Incorrectly Return False When Testing for Zero (310998)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
- Microsoft Visual FoxPro for Windows 3.0b
- Microsoft Visual FoxPro for Windows 5.0
- Microsoft Visual FoxPro for Windows 5.0a
- Microsoft Visual FoxPro for Windows 6.0
- Microsoft Visual FoxPro for Windows 7.0
This article was previously published under Q310998 SYMPTOMS
If you do floating point math and test the result for zero with the EMPTY() function and the equals operator (=), you may see different results.
CAUSE
Floating point math does the computations in binary fractions, which may not convert exactly back to decimal. Rounding errors can cause the internal representation of values to be slightly different than their displayed values.
RESOLUTION
Either test for the value being equal to 0 (because the = operator allows for slight differences) or round the value you are testing to the number of decimal places used in your computations.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbCodeSnippet kbnofix kbprb kbXBase KB310998 |
---|
|