|
-
Oct 7th, 2007, 07:25 PM
#1
Thread Starter
Member
[RESOLVED] Rounding down an unknown number according to its (negative) size
Hi there,
a week ago I started a thread called "Rounding up an unknown number according to its size".
I wanted to find a reasonable map category upper bound for model results. For example, result 204.2 would have an upper bound of 250; 2.042 would lead to 2.5; 2,634 would lead to 3,000, etc.
The code below does a great job as long as n > 1.
n = Fix(x) + (5 * 10 ^ (Len("" & Fix(x)) - 2)) - Fix(x) Mod (5 * 10 ^ (Len("" & Fix(x)) - 2))
' where x is Single positive number, n is a Long number. Any x < 1 will give n = 1.
Now I realize that I also need a lower bound for negative numbers. For example, model result "- 127.8" should return "-150".
Would you have any idea how I can achieve this?
Thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|