Math

After a comment on the last entry, I will now work out a bit about numbers in base -2. To start, I'll convert a random number to base 10. 101 would mean: 1*(-2)^2 + 0*(-2)^1 + 1*(-2)^0 or 5. From right to left, putting a 1 instead of a 0 is worth 1 -2 4 -8 16 -32 64

So, to get the number 2, we have to write -10. It seems very confusing, on a human level, that using a minus sign has nothing to do with whether the number is negative or not. I guess a computer wouldn't care about that, except that we often work in positive numbers, and can use unsigned numbers to save space.

Now I'll count to 10 in base -2:

0001 -0010 0111 0100 0101 -1110 -1001 -1000 11001 -1010 which is really jumpy, and a total mess for humans, and it's very strange to need more digits to write 9 than 10. I think it would be slow for computers to do addition with this. In positive bases, using digits from 0 to base-minus-one, adding is nice, because you just increment the one's column repeatedly (and each time it overflows, reset it to zero, and increment the next column). There are tricks, like if you have two numbers in the same base, you can add various other columns directly to each others. There may be tricks with base -2 also, but I still bet it's inefficient, because you can't just increment the next column when one overflows.

Elliot Temple on February 6, 2003