Take the 2-minute tour ×

History: I read from one of Knuth's algorithm book that first computers used the base of 10. Then, it switched to two's complement here.

Question: Why does the base could not be -2 in at least a monoid?


(-2)^1 = -2 
(-2)^3 = -8
share|improve this question
Base 10 and two's complement are two very different things. The former being a numbering system while the latter is a representation of negative numbers in binary. What exactly do you mean? (Also, obligatory joke: Every base is base 10.) –  Eric Jul 8 '09 at 16:54
What is "substraction"? Is it a lower form of abstraction? Is it the process of creating a substrate? –  ShreevatsaR Jul 8 '09 at 16:56
and, (-2)^2 = 4, (-2)^4 = 16... way to go. This can be fun –  nik Jul 8 '09 at 17:08
Base -2 is nonsensical. –  Zifre Jul 8 '09 at 17:09
@Zifre: No, en.wikipedia.org/wiki/Negative_base –  Draemon Jul 8 '09 at 17:10
show 4 more comments

8 Answers

up vote 19 down vote accepted

The problem is that with a negabinary (base -2) system, it's more difficult to understand, and the number of possible positive and negative values are different. To see this latter point, consider a simple 3 bit case.

Here the first (rightmost) bit represents the decimal 1; the middle bit represents the decimal -2; and the third (leftmost) bit represents the decimal 4


000 -> 0

001 -> 1

010 -> -2

011 -> -1

100 -> 4

101 -> 5

110 -> 2

111 -> 3

Thus the range of expressable values is -2 to 5, i.e. non-symmetric.

share|improve this answer
+1 The first one to answer the question. –  balpha Jul 8 '09 at 17:08
such an asymmetric range would be a pain to work with... +1 –  jalf Jul 8 '09 at 17:11
@balpha: It answers "why not base -2" but not "why base 2" which as others have pointed out has to do with electrical characteristics. –  Draemon Jul 8 '09 at 17:13
You should look at the gray code. It doesn't go exactly like this, but close -- there is a pattern everywhere. –  nik Jul 8 '09 at 17:15
@Draemon: You only need two digits when working with base (-2) -- just as you do when working with base 2. So electrical characteristics don't prevent you from using base (-2) -- it's still just ON or OFF. –  balpha Jul 8 '09 at 17:27
show 1 more comment

At its heart, digital logic is base two. A digital signal is either on or off. Supporting other bases (as in BCD) means wasted representation space, more engineering, more complex specification, etc.

Editted to add: In addition to the trivial representation of a single binary digit in digital logic, addition is easily realized in hardware, start half adder which is easily realized in Boolean logic (i.e. with transistors):

   (No carry) (with carry)
  |  0   1      0   1
0 | 00  01     01  10
1 | 01  10     10  11

(the returned digit is (A xor B) xor C, and the carry is ((A and B) or (C and (A or B))) ) which are then chained together to generate a full register adder.

Which brings us to twos complement: negation is easy, and the addition of mixed positive and negative number follows naturally with no additional hardware. So subtraction comes almost for free.

Few other representations will allow arithmetic to be implemented so cheaply, and I know of none that are easier.

share|improve this answer
dmackee: Good point. I was thinking it. It is much more complex to handle the base of -2, but it has some nice properties. For example, you can multiply any number like: 2_10 * 1000_(-2) (where 10 and -2 are bases), then you get 10000_(-2) + 2* 1000_(-2) = 0. It actually very cool thing, it is like having a switch to turn a machine off just by multiplying by 2. –  Masi Jul 8 '09 at 17:01
You just answered your own question: "It is much more complex to handle the base of -2". CPU designers do not want complexity. They want efficiency. –  jalf Jul 8 '09 at 17:15
I feel that the method does not really make things more complex, it only moves the complexity. The reason for the question lies partly in the idea about Crash-only Machines. If the states were trasferred to a upper level by a new design of the whole base, I feel it would be much more simpler to design processes you can simply turn off and on. Not 100% sure though. I hope you can see where I am aiming at! –  Masi Jul 8 '09 at 17:31
add comment

Optimization in storage and optimization in processing time are often at cross purposes with each other; all other things being equal, simplicity usually trumps complexity.

Anyone can propose any storage mechanism for information they wish, but unless there are processors or algorithms that support it, it won't get used.

share|improve this answer
add comment

There are two reasons to choose base 2 over base -2:

First, in a lot of applications you don't need to represent negative numbers. By isolating their representation to a single bit you can either expand the range of representable numbers, or reduce the storage space required when negative numbers aren't needed. In base -2 you need to include the negative values even if you clip the range.

Second, 2s complement hardware is simple to implement. Not only is simple to implement, it is super simple to implement 2s complement hardware that supports both signed and unsigned arithmetic, since they are the same thing. In other words, the binary representation of uint4(8) and sint4(-15) are the same, and the binary representation of uint(7) and sint4(7) are the same, which means you can do the addition without knowing whether or not it is signed, the values all work out either way. That means the HW can totally avoid knowing anything about signs and let it be dealt with as a language convention.

share|improve this answer
add comment

Also, the use of the binary system has a mathematical background. Consider the Information Theory by Claude Shannon . My english skills don't qualify to explain this topic, so better follow the link to wikipedia and enjoy the maths behind all this stuff.

share|improve this answer
+1 Great thanks for mentioning the place for further study! –  Masi Jul 8 '09 at 20:06
add comment

In the end the decision was made because of voltage variance.

With base 2 it is on or off, no in between.

However with base 10 how do you know what each number is?

is .1 volts 1? What about .11? Voltage can vary and is not precise. Which is why an analog signal is not as good as a digital. This is if you pay more for a HDMI cable than $6 it is a waste, it is digital it gets there or not. Audio it does matter because the signal can change.

share|improve this answer
Not really true about digital cabling - the better better the cable is at rejecting (analogue) noise, the less likely it will "flip" a bit from 1->0 or 0->1. –  Draemon Jul 8 '09 at 17:07
Digital and analogue signals are affected differently by noise of course - generally speaking a digital signal is more tolerant of noise, but tends to have a more dramatic effect when the noise becomes an issue. Compare old analogue TV which degrades easily but gradually vs digital which is more resilient but when it fails it really fails. –  Draemon Jul 8 '09 at 17:09
+1 for physical perspective. –  Masi Jul 8 '09 at 20:45
I agree -- it's easier to calculate on or off than 10 different voltage levels. Analog computers took this a step farther, essentially using a voltage level for floating point values. It was a little more complex than that, of course, but the precision wasn't quite as good as digital computers. –  xpda Aug 19 '09 at 5:36
add comment

Please, see an example of the complexity that dmckee pointed out without examples. So you can see an example, the numbers 0-9:

0 = 0
1 = 1
2 = 110
3 = 111
4 = 100
5 = 101
6 = 11010
7 = 11011
8 = 11000
9 = 11001
share|improve this answer
add comment

1's complement does have 0 and -0 - is that what you're after?

CDC used to produce 1's complement machines which made negation very easy as you suggest. As I understand it, it also allowed them to produce hardware for subtraction that didn't infringe on IBM's patent on the 2's complement binary subtractor.

share|improve this answer
add comment

Your Answer


