Digital technology and semiconductor circuit design

Negative integers in the dual system WebApp

Three formats are used for the representation of negative integers in the binary system. Standard in arithmetic unit is the two's complement because of the very easy realisation of arithmetic operators. Furthermore, it can be presented with absolute value and sign or in one's complement. Here you find a comparison of those formats. Here you can find general information to number notation and number systems .

Absolute value and sign

The simplest way to display negative integers is a seperate treatment of absolute value and sign. In this format, the first figure determines the sign(MSB - Most Significant Bit). All further figures describe the number's total value. For example, the number's total value \(x = \) is tranformed to 11011. (How does it work?) 5 figures are needed in total for the determination of the number 27. For displaying -27, the negative sign is prefixed. 1 stands for a positive sign and 0 for a negative sign.

This results in:

2710=
0110112
(-27)10 =
1110112

One's complement

The one's complement necessites, as before, an additional Bit. Yet, here is no longer independance of total value and sign. The MSB is supplemented with 0 through a further addition and in case of a negative number all digits are modified. Again, the sign can be recognized in the first number. The bit sequence for the number's total value\(x = \) with an attached 0 at the right side 011011. For a negative sign, all digits are inverted

which results in:

2710 =
0110112
(-27)10 =
1001002

Two's complement

A problem which entails the one-complement is that the value 0 can not be represented unambiguously. (0000 oder 1111) This problem solves the two's complement by adding an LSB (Least Significant Bit) after the inversion of all numbers. The number \(x = \) is 011011 in binary represenation. The one's complement is 100100 and 1 LSB has to be added. After the addition, the two's complement

is wirtten as

2710 =
0110112
(-27)10 =
1001012

Comparison of the formats

All of the above formats can be used to display negative numbers in the dual system: The numbers \(x=\) can be displayed as follows.
The binary represenation \(x\) results in 11011. In each format, there is an extension of the positive number with a 0 on the left side. A negative number can be displayed in multiple ways. In each case, there is a MSB of 1.
Positive number

The total amount of \(x\) is extended by a 0 on the left side.


2710 = 0110112
Total amount and sign

The sign bit is set on 1, the remaining numbers which constiute the total amount of \(x\) remain unmodified.


(-27)10 = 1110112
One's complement

All digits which are extended by 0 are inverted.


(-27)10 = 1001002
Two's complement

After the inversion of all digits, a LSB is added(see here).


(-27)10 = 1001012
Nach oben scrollen