Microsoft KB Archive/247494: Difference between revisions
m (Text replacement - "<" to "<") |
m (Text replacement - ">" to ">") |
||
Line 59: | Line 59: | ||
<p>-or-</p></li> | <p>-or-</p></li> | ||
<li><p>Use this code:</p> | <li><p>Use this code:</p> | ||
<pre class="codesample">ALLTRIM(STR(<nExpr | <pre class="codesample">ALLTRIM(STR(<nExpr>, <nLength>, <nDecimalPlaces>))</pre> | ||
<p>-or-</p></li> | <p>-or-</p></li> | ||
<li><p>Use this code:</p> | <li><p>Use this code:</p> | ||
<pre class="codesample">SET DECIMALS TO <nDecimalPlaces | <pre class="codesample">SET DECIMALS TO <nDecimalPlaces> | ||
SET FIXED ON</pre></li></ul> | SET FIXED ON</pre></li></ul> | ||
'''NOTE''': Setting the nDecimalPlaces to | '''NOTE''': Setting the nDecimalPlaces to >= 15 for any work around results in an overflow error. | ||
</div> | </div> | ||
Line 79: | Line 79: | ||
== MORE INFORMATION == | == MORE INFORMATION == | ||
The '''TRANSFORM''' function was modified to allow the developer to issue Transform(<nExpr | The '''TRANSFORM''' function was modified to allow the developer to issue Transform(<nExpr>) without a format or picture clause. The result is similar to ALLTRIM(STR(<nExpr>, <nLength>, <nDecimalPlaces>)). | ||
=== How to Reproduce the Behavior === | === How to Reproduce the Behavior === | ||
Revision as of 08:43, 21 July 2020
Article ID: 247494
Article Last Modified on 10/15/2002
APPLIES TO
- Microsoft Visual FoxPro 6.0 Professional Edition
This article was previously published under Q247494
SYMPTOMS
You might see that the results of the TRANSFORM() function appear off by approximately .0000000000001. This behavior may occur when COMPATIBLE is OFF. However, when COMPATIBLE is ON, the expected behavior is observed.
RESOLUTION
Workaround
Here are three ways to work around this behavior:
Use this code:
SET COMPATIBLE ON
-or-
Use this code:
ALLTRIM(STR(<nExpr>, <nLength>, <nDecimalPlaces>))
-or-
Use this code:
SET DECIMALS TO <nDecimalPlaces> SET FIXED ON
NOTE: Setting the nDecimalPlaces to >= 15 for any work around results in an overflow error.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
MORE INFORMATION
The TRANSFORM function was modified to allow the developer to issue Transform(<nExpr>) without a format or picture clause. The result is similar to ALLTRIM(STR(<nExpr>, <nLength>, <nDecimalPlaces>)).
How to Reproduce the Behavior
Enter the following code in a program and run the program:
CLEAR cCompatible = SET("COMPATIBLE") SET COMPATIBLE OFF ? "Precision automatically jumps to 15 decimal places " ? "with overflows displayed at 1.6" FOR i = 1 TO 3 STEP .1 ? TRANSFORM(i) ENDFOR SET COMPATIBLE &cCompatible
The values should begin to miscalculate around the number 1.6.
Additional query words: TRANSFORM, ALLTRIM, STR, BUG,PRECISION,OVERFLOW
Keywords: kbbug kbxbase kbcodesnippet kbpending KB247494