>>Is there any pre-defined function in VFP that allows the truncation of a decimal. For example if I want to get 0.465 from 0.4655? Any form of help is appreciated.
>>
>>Thanks.
>
>Hmm. Not a native function that I know of, butyou could use this:
>
>x = 0.4655
>n = 3 && number of decimals to round to
>lnRounded = INT(x*10^n)/10^n
>
>Even works for rounding to places to the left of he decimal by using a negative number for n.
How about something like:
ln = 0.4655
lc =STR(ln, 9,4)
lc = SUBSTR(lc,1,len(lc) -1)
set decimals to 3
ln = VAL(lc)
**** 0.465
:)
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison