Can anyone help me understand what is base -2? I understand base in positive integers and know how to convert a decimal number to those bases, but really do not have any idea with negative base.
Asked
Active
Viewed 262 times
0
-
what language did you prefer?? python or in general?? – Ami Oct 18 '12 at 04:05
1 Answers
0
This exotic base descried in the book: http://www.hackersdelight.org/hacker2TOC.pdf And, is not practical.
But, basic idea as same as with a regular binary code:
ABCD == A*(-2)^3 + B*(-2)^2 + C*(-2) + D
Example of numbers:
-2 Decimal
-------------------
000 0
001 1
010 -2
011 -1
100 4
101 5
And so on.

olegarch
- 3,670
- 1
- 20
- 19