round ceiling for max 5?

queglay's icon

Hello,

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

thanks for any help.

jvkr's icon

expr int($f1)+1?
_
johan

andrea agostini's icon

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)

Emmanuel Jourdan's icon
Max Patch
Copy patch and select New From Clipboard in Max.

How about jstrigger?

mudang's icon

[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)

Peter Castine's icon

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.

Roman Thilenius's icon
queglay's icon

thanks for suggestions guys, i wil try lp.scampi

queglay's icon

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

Wetterberg's icon

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

Peter McCulloch's icon

How about:

Max Patch
Copy patch and select New From Clipboard in Max.

+ 0.5
|
round

pythagoras's icon

Peter,

Using 0.4999 works (for most uses) but 0.5 will round any integer up to the next integer instead of staying unchanged.

Incidentally I am looking for a floor/ceil object. I have to say it's quite annoying searching around for such basic things when they could have been implemented easily in the round object to begin with...