This might be silly, but here are three abstractions I made a couple years or so when I was learning...
the "nearest" one defaults to the higher value for numbers halfway between. Matt > Date: Fri, 12 Dec 2008 00:48:48 +0900 > From: "hard off" <hard....@gmail.com> > Subject: [PD] nearest power of 2 > To: "Pd List" <pd-l...@iem.kug.ac.at> > Message-ID: > <161320dd0812110748w620d032g7b9bdff22d2f4...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > what's the easiest way for pd to find the nearest power of 2 for any float? > > > so 10 would give a result of 8, > 53 would give a result of 64, > > etc.. > > > http://en.wikipedia.org/wiki/Power_of_two#Algorithm_to_convert_any_number_into_nearest_power_of_two_number > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: > http://lists.puredata.info/pipermail/pd-list/attachments/20081212/bb3be031/attachment-0001.htm > > ------------------------------
nextpowoftwo.pd
Description: Binary data
lastpowoftwo.pd
Description: Binary data
nearestpowoftwo.pd
Description: Binary data
_______________________________________________ Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list