this is making my brain hurt... is there an object to do it automatically?...
for various reasons (mostly due to being on a windows machine and wanting a quick solution) i'd like to do this with expr or other built in objects (ruby, py etc. not really an option as of now)
i've got a snippet of python from the net, would anyone translate this into an expr for me? (in return for my eternal gratitude ;-)
def Denary2Binary(n): '''convert denary integer n to binary string bStr''' bStr = '' if n < 0: raise ValueError, "must be a positive integer" if n == 0: return '0' while n > 0: bStr = str(n % 2) + bStr n = n >> 1 return bStr
all the best
adam
___________________________________________________________ All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
adam armfield wrote:
this is making my brain hurt... is there an object to do it automatically?...
for various reasons (mostly due to being on a windows machine and wanting a quick solution) i'd like to do this with expr or other built in objects (ruby, py etc. not really an option as of now)
[nbx] | [expr $f1>>0&1; $f1>>1&1; $f1>>2&1; $f1>>3&1; ... ]
and so on... depending on how many bits you want to display
hth, ciao
Federico
hello, Marc Lavallée has wrote two abstractions for doing what you are looking for:
http://lists.puredata.info/pipermail/pd-list/2005-08/030459.html
patco~
adam armfield adamairmailed@yahoo.com a écrit : this is making my brain hurt... is there an object to do it automatically?...
for various reasons (mostly due to being on a windows machine and wanting a quick solution) i'd like to do this with expr or other built in objects (ruby, py etc. not really an option as of now)
i've got a snippet of python from the net, would anyone translate this into an expr for me? (in return for my eternal gratitude ;-)
def Denary2Binary(n): '''convert denary integer n to binary string bStr''' bStr = '' if n < 0: raise ValueError, "must be a positive integer" if n == 0: return '0' while n > 0: bStr = str(n % 2) + bStr n = n >> 1 return bStr
all the best
adam
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire.
What type of output are you looking for? Because beyond 6 digits, Pd's floating point numbers look funny, and 6 digits only covers 63 in binary. Do you want a character string? I don't know what kind of format you can work with. Pd could, alternatively, output 1's and 0's sequentially as a series of floats.
On 6/25/06, adam armfield adamairmailed@yahoo.com wrote:
this is making my brain hurt... is there an object to do it automatically?...
for various reasons (mostly due to being on a windows machine and wanting a quick solution) i'd like to do this with expr or other built in objects (ruby, py etc. not really an option as of now)
i've got a snippet of python from the net, would anyone translate this into an expr for me? (in return for my eternal gratitude ;-)
def Denary2Binary(n): '''convert denary integer n to binary string bStr''' bStr = '' if n < 0: raise ValueError, "must be a positive integer" if n == 0: return '0' while n > 0: bStr = str(n % 2) + bStr n = n >> 1 return bStr
all the best
adam
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine http://uk.docs.yahoo.com/nowyoucan.html
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
On Mon, 26 Jun 2006, adam armfield wrote:
this is making my brain hurt... is there an object to do it automatically?...
| |------------. [t f f] | | | | [% 2] [/ 2] | | | | | [i] | | | | | [sel 0] | | `------' [print]
#N canvas 0 0 450 300 10; #X obj 113 48 t f f; #X obj 143 67 / 2; #X obj 143 105 sel 0; #X obj 113 140 print; #X obj 113 67 % 2; #X floatatom 115 29 5 0 0 0 - - -; #X obj 143 86 i; #X connect 0 0 4 0; #X connect 0 1 1 0; #X connect 1 0 6 0; #X connect 2 1 0 0; #X connect 4 0 3 0; #X connect 5 0 0 0; #X connect 6 0 2 0;
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montréal QC Canada