Talk:Bitwise operations: Difference between revisions

not a storage issue
(→‎assumption of how integers are stored=: added observation. == ~~~~)
(not a storage issue)
Line 11:
(actual) binary value of the characters (which may be a representation of an integer, or some other number), but the
binary bits would be different on an ASCII machine vs. an EBCDIC machine. -- [[User:Gerard Schildberger|Gerard Schildberger]] 23:35, 22 March 2012 (UTC)
:I do not see any such assumption. I do see a request "If any operation is not available in your language, note it." That said, these operations can be performed in most languages regardless of how numbers are stored:
:There will typically be some largest value for n where all values starting from 0 and less than 2^n can be represented in the language. On a machine that stores numbers in twos complement binary, n will typically be 31 on a 32 bit machine and 63 on a 64 bit machine, but as long as some kind of integer numbers are representable n will probably be non-zero. And note that this does not depend on how the numbers are stored.
:There is a one-to-one relationship between any integer in the range 0..((2^n)-1) and a list of true/false values of length n. If the language is capable of representing such lists, it should not be hard to build functions to convert a number between these two forms.
:And, once you have achieved a binary representation. the rest of the problem is trivial. The language does not have to do this for you for it to be possible. --[[User:Rdm|Rdm]] 15:18, 23 March 2012 (UTC)
6,951

edits