Section 6.3: Signed binary numbers (integers) (Frame 1)                     [     ][home][next]

The methods shown above give positive binary numbers for positive decimal numbers. Actually, they are numerals, but we will not quibble over philosophical distinctions, not when there's a computer to build!! The next problem to tackle is how to encode negative numbers.

There are three main methods of doing this, the first one being the most obvious and intuitive, called sign-magnitude form. Merely add an extra bit to the binary number to encode the sign. The most obvious encoding is to use 0 for + and 1 for -, probably because if the minus is rotated 90o, it looks like a 1. The one tricky point is that the maximum number of bits must be set and then the number must be padded out with 0s so that the minus sign is always in the same bit position. For instance, an 8-bit number must add a 9th bit for the sign, usually at the front. Thus, +1 becomes 000000001 and -1 is 100000001. Note the extra padding zeroes. If they weren't there, the representation for -1 would be 11, which looks like 3. In fact, there would be no way to tell between 3 and -1.