
1. Re: URGENT!! Help On Rounding Numbers
mrvodka Feb 24, 2010 1:33 PM (in response to dekade)Try:
Let ( m = Mod ( Finished Length; 1 );
Case ( m > .5; 14;
m > .3125; 13.5;
13
)
) 
2. Re: URGENT!! Help On Rounding Numbers
ninja Feb 24, 2010 1:35 PM (in response to dekade)Howdy,
never used the MOD() function myself, but it seems appropriate here. Others will correct me if I get it screwy...
Case ( Mod(FinishedLength,1) <= 0.3125 ; FinishedLength  Mod(FinishedLength,1) ;
Mod(FinishedLength,1) <= 0.5000 ; FinishedLength + 0.5  Mod(FinishedLength,1) ;
FinishedLength + 1  Mod(FinishedLength,1)
)
I think I have the syntax right...but you should see the approach at least..
Edit: Mr. V beat me to it...I'll have to get more comfortable with the "Let"...that approach is much cleaner.

3. Re: URGENT!! Help On Rounding Numbers
comment_1 Feb 24, 2010 2:04 PM (in response to dekade)I believe it should be:
Let (
r = Mod ( FinishedLength ; 1 )
;
Int ( FinishedLength ) + Case (
r > .5 ; 1 ;
r > .3125 ; .5
)
)Note that this assumes FinishedLength is not a negative number.

4. Re: URGENT!! Help On Rounding Numbers
mrvodka Feb 24, 2010 2:05 PM (in response to dekade)Apologies. I misunderstood your post.
Try:
Let ( [ m = Mod ( Finished Length; 1 );
n = Int ( Finished Length )
]; n + Case ( m > .5; 1; m > .3125; .5 )
)
* Edit  Didnt see comment's post

5. Re: URGENT!! Help On Rounding Numbers
dekade Feb 24, 2010 4:16 PM (in response to dekade)To Mr Vodka and Comment:
I thank you so very much. It looks like the first reply from mr vodka only returned the answers 13, 13.5 etc. As you both went further down the post we ended up with a formula that allows the "Finished Length" field to be absolutely 'any'; not specifically 13.xxxx.
Am I reading the both of you correctly? If so I am ready to continue my project. If I'm wrong please advise me. Otherwise I hope that someone can help both of you someday the way you both have quickly helped me. THANKS
Dekade
OOPS! JUST NOTICED SOMETHING.
Let ( [ m = Mod ( Finished Length; 1 );
n = Int ( Finished Length )
]; n + Case ( m > .5; 1; m > .3125; .5 )
)
In the 3rd line of the calculation doesn't 'm' need to be greater than .3125 but less than .5?
If so how do you then write the third line?
DEKADE


7. Re: URGENT!! Help On Rounding Numbers
mrvodka Feb 25, 2010 1:34 PM (in response to dekade)
dekade wrote:In the 3rd line of the calculation doesn't 'm' need to be greater than .3125 but less than .5?
No. In a case calculation it exits out once a criteria is met.
We do not have to check if its less than .5 in the second test of the Case () statement because it was already checked to see if it were greater than .5 in the first part. If it had past that test it would have resulted in 1 and skipped the rest of the evaulations. Therefore, we already know that it cant be > .5. The second test checks to see if its > .3125. So that condition would be met if the value is > .3125 up to and including .5