Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Keeping last 4 digits?
Message
From
09/07/2006 12:46:39
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01134716
Message ID:
01134788
Views:
21
>>I have a series of numbers with up to 9 significant digits after the decimal point and would like to truncate the character values down to 4 significant digits.
>>
>>For example I have the following two values:
>>
>>123.456789012
>>98.765432109
>>
>>I want to return these values:
>>
>>123.4567
>>98.7654
>>
>>I can write a function to use something like ATC() to find the decimal point but is there a better way? Sergey, you will no doubt have something interesting and insightful so thanks in advance...:>)
>
>
>IANS but how about ROUND(lnX, 4)?

It gives you the four decimals, period. Not the four significant digits. If I remember correctly, significant digits are those that remain when leading and trailing zeros are ignored. The following code will display four significant digits across the range:
x=123456789012
Set Decimals To 10
For i=1 To 18
	?x, Round(x, Iif(Abs(x)>1000, 3,4)-Log10(Abs(x))) At 40
	x=x/10
Endfor
But now since you got the stars, I figure the originator had some other idea about the meaning of the term "significant digits".

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform