Round matrix floats

mooter's icon

Is there [round] equivalent for jitter? Op only does integers, and I'd lke to get my values rounded to the nearest .25 (or .0125/.00625 if possible)

I was thinking maybe an expression is possible but I'm not sure how to write it.

Floating Point's icon

it seems round only rounds to nearest integer, and doesn't take a second argument (either in jit.op or jit.expr).

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

heres a workaround:

mooter's icon

Ok so it did need to be an expression. Thank you very much!

So to get a better understanding of what's going on, am I interpreting this correctly?

jit.expr is using the round op to round to the nearest integer, so the expression is as follows:

round to nearest int((by the one divided by value set at inlet 1) * matrix float from inlet 0) * value set at inlet 1)

so if I just neeeded to round to the nearest .25 and not need the 2nd inlet, the expr could go as: round((1/.25)*in[0])*.25

Is that right? It seems so...
I figured it wouldn't need to be an advanced expression, but I need to increase my math skills.

I'll post my patch when I finish it (M4L device)
This will be very helpful in another context later on, as well:)

Thanks again:)

Floating Point's icon

yep, no worries , your interpretation is correct (btw jit.expr (and jit.op for that matter) is not well documented, so your kind of quandary is to be expected)