I found in Wikipedia that you can convert base 10 to a negative base simple by dividing to a base and keeping remainder like this:
Source: http://en.wikipedia.org/wiki/Negative_base
Now I'm stuck here.
I want to convert two digits -6 and 6 no base(-2)
Now example:
I do this:
6 / -2 = -3, remainder 1
-3/ -2 = 1, remainder 1
1/ -2 = 0, remainder 0
so, the final result is 0011 which is not quite right, because 1x(-2) + 1 = -1, not six.
HELP!
Update:
And one more question concerning negabinary:
Suppose we use 2n bits to represent integers using base −2 encoding, for n > 0. What is the largest integer we can represent? What is the smallest?
What I'm thinking is that the smallest number is 0, because we cannot represent -1 in negative numbers of bits. 2x(-1) = -2. ANd there's no limit to a max number since 2x(10000) will fit in 200000 bytes.