Hi, i have a problem i need to fix, i have a system giving a decimal number of 8 digits.
eg. 10010001 (with no spaces)
I need to be able to tell wether a certain digit in the number is 1 or 0, for example as above if digit 4 is at 1 then bang output, etc etc.
any help would be great as i have searched the help files and consulted my collegues, i hope i am just overlooking something simple.
I would also be very interested in knowing if this can be done easily, but i am working with binary numbers.
Last time I looked, these questions were answered in the tutorials.
With decimal use % and /.
For instance, to get the hundreds digit [num]->[/ 100]->[% 10]
To extract bits, use the [&] object to mask out the bit you’re interested in, then optionally bit shift with [>>].
For instance, to get bit 3 (counting from *right* starting with zero) [num]->[& 8]->[>> 3].
If you just want to use the calculation to control a logic object (like if or a ggate), you can skip the bit shift.
These are really not Max-specific questions, they are fundamental DP techniques.
GREAT, thank you Vanille!
Log in to reply
Let us tell you about notable Max projects, obscure facts, and creative media artists of all kinds.