BUG: FoxPro Math-Precision Problems with SET DECIMALSID: Q114136 The information in this article applies to:
SYMPTOMSSET DECIMALS TO 2 changes the result when a numeric expression that evaluates to a decimal value is used in a comparison. For example, type the following in the Command window:
Under dBASE IV, both of these expressions will return FALSE.
In FoxPro version 2.6a, a similar decimal-precision problem occurs when any whole number is used in math problems. For example:
However the behavior of FoxPro versions 2.5x, 2.6 and Visual FoxPro is
closer to that of dBase. For example:
RESOLUTIONIf you need greater precision in FoxPro, set the SET DECIMALS command to a higher value. For greater precision with constants, replace the constants with memory variables, so that FoxPro performs the calculation at run time. If you must use constants, express them in the precision that is desired. For example, use this expression
rather than this one:
STATUSMicrosoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
MORE INFORMATIONNOTE: FoxPro returns a zero when the first significant digit is in the seventh position to the right of the decimal; for example, 0.0000001. Additional query words: math set decimal kbFP250 kbFP260 kbvfp300 kbvfp500 kbvfp600
|
Last Reviewed: October 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |