how to round float number to a list of integers

kyl12's icon

eg: round 50.99 to a list of integers [48 50 52 53 55 57 59], which then equals 50

eg: round 100.0 to the same list of integers, which then equals 59

kyl12's icon

so to clarify, i wish for my patcher to be able to automatically round an input decimal number, to a list of integers. So then the only possible output are those integers in the list.. like these examples...

list of integers the input compares to: 48, 50, 52, 53, 55, 57, 59

input: 2.2 => output: 48
input 55.9 => output: 55
input: 56.0 => output: 57
input: 1000 => output: 59

I tried looking at the "round" object but I couldnt figure if its able to do what i want. hope that clears things up. many thanks in advance!

Bas van der Graaff's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Ah, took reading 2 times before I understood what you meant. I think that's a lot of functionality for 1 object, the splitting and rounding to specific ints (and also rounding lower number input to the lowest int). If you just need the above thing to work, I'd suggest [multisplit] from the Jasch objects:

Tj Shredder's icon

You could do it with my closest abhaXion...
(get it at http://dl.dropbox.com/u/288305/St.ools%20for%205.zip)

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

kyl12's icon

thank you both kindly for yur help! ill give them both a shot