Forums > MaxMSP

round ceiling for max 5?

February 6, 2011 | 11:32 am

Hello,

are there any externals for rounding to the ceiling for max 5?

thanks for any help.


February 6, 2011 | 12:40 pm

expr int($f1)+1?
_
johan


February 6, 2011 | 1:28 pm

Hi.
This won’t work if the input is an integer.

There’s a ceil function by Jasch, or you can use bach.expr…
… or
[expr (($f1 >= 0) * int(($f1 != int($f1)) + $f1)) + (($f1 < 0) * int ($f1))]
will do the trick (not sure it’s the most clever way, though)


February 6, 2011 | 2:30 pm

How about jstrigger?

– Pasted Max Patch, click to expand. –

February 6, 2011 | 7:14 pm

[expr int($f1+0.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999)]

:D

Edit:
Oh…that actually doesn’t work :(
but if you don’t mind the low accuracy:
expr int($f1+0.99999)


February 7, 2011 | 10:28 pm

lp.scampi has ceil, floor, trunc, round, and toinf modes for converting floats to integer.

Max 5 users will want the version of lp.scampi in the Litter Pro Bundle. Lp.scampi is also included in the free Litter Start Pack, but the Starter Pack is really only happy in the Max 4 world. I may get so tired of writing this caveat that I get an updated, Max 5-friendly version of the Starter Pack out. Still, there *is* always the Pro Bundle, which is quite happy in Max 5.


February 8, 2011 | 4:05 am

   


February 8, 2011 | 9:14 am

thanks for suggestions guys, i wil try lp.scampi


May 31, 2013 | 5:46 am

is there anything in max 6 that does this? im surprised its not a standard expression.


May 31, 2013 | 2:26 pm

[jit.ceil] ought to work, I guess.


May 31, 2013 | 11:42 pm

How about:

+ 0.5
|
round

<code>

– Pasted Max Patch, click to expand. –

</code>


Viewing 11 posts - 1 through 11 (of 11 total)