Try this:
SET DECIMAL TO 1
lnVar1 = 44/7
? lnVar1 && 6.3
SET DECIMAL TO 2
lnVar2 = lnVar1
? lnVar2 && 6.3 ??? this is the weird thing IMO
Do you find this strange? Even though a SET DECIMAL TO 2 was issued before a value was assigned to lnVar2, when lnVar2 was printed, it displayed one decimal.
It appears that the lnVar2 = lnVar1 assignment is respecting the SET DECIMAL TO setting of when lnVar1 was created.
If you perform the above series of command, only substitute
lnVar2 = lnVar1
with
lnVar2 = 6.29222
the ? lnVar2 line will show the expression to 2 decimal places.
Joe
>>What I didn't know and have come to realize is that VFP does not store the value of an expression in the memory variable. It stores the expression and display properties of that expression.
>
>Larry,
>
>I believe that that is incorrect. The variable has a number in it, not the expression. The presision of the nember is also stored. For example;
>
>
>set decimals to 1
>lnVar = 7/74*100
>?lnVar
>? lnVar + .0000001
>
>
>The numbers following the 4 are not 0's, so the actual value in teh variable is not 9.5 as was displayed, but is some other number which was rounded to 9.5 for display.
>
>Also a Display Memory will show you the actual number stored in lnVar without regard to the set decimals setting. It appears that the ROUND() function is not using the displayed value but the actual value.
Joseph C. Kempel
Systems Analyst/Programmer
JNC