One’s Complement Method

The One’s Complement Method is a technique used to represent signed integers (both positive and negative) in binary form. It is an older method that was once widely used in digital systems and computer arithmetic, although it has largely been replaced by the more efficient two’s complement method in modern systems. Understanding one’s complement is essential for grasping the evolution of binary number systems and their applications in computing.

Basic Concepts of Binary Number Representation

Before diving into the one’s complement method, it’s important to understand the basics of binary number representation:

  • Binary System (Base 2): The binary number system uses only two digits, 0 and 1, to represent numbers. Each digit in a binary number is called a bit.
  • Unsigned Binary Representation: Unsigned binary numbers represent only non-negative integers. For example, the binary number 101021010_2 represents 1×23+0×22+1×21+0×20=10101 \times 2^3 + 0 \times 2^2 + 1 \times 2^1 + 0 \times 2^0 = 10_{10} in decimal.

When dealing with both positive and negative numbers, special methods like one’s complement are used.

One’s Complement Method

In the one’s complement method:

  • Positive numbers are represented in the same way as in unsigned binary.
  • Negative numbers are represented by inverting (flipping) all the bits of the corresponding positive number.

For example, to represent 5-5 in one’s complement form:

  1. Start with the binary representation of +5+5, which is 010120101_2 (in a 4-bit system).
  2. Invert all bits: 010120101_2 becomes 101021010_2.
  3. 101021010_2 is the one’s complement representation of 5-5.
Example: 4-Bit One’s Complement Representation

Let’s consider a 4-bit binary system using the one’s complement method:

  • Positive numbers: Represented as in unsigned binary.
  • Negative numbers: Obtained by inverting all bits of the positive counterpart.

Examples:

  • +310+3_{10} in 4-bit binary is 001120011_2.

    • To find 310-3_{10}, invert all bits: 001120011_2 becomes 110021100_2.
  • +710+7_{10} in 4-bit binary is 011120111_2.

    • To find 710-7_{10}, invert all bits: 011120111_2 becomes 100021000_2.

Here’s a table showing all possible 4-bit one’s complement representations:

Decimal ValuePositive BinaryOne’s Complement (Negative)
+70111
+601101001
+501011010
+401001011
+300111100
+200101101
+100011110
+000001111
-01111
-11110
-21101
-31100
-41011
-51010
-61001
-71000
Important Observations:
  • Positive and negative zero: In a 4-bit system, both 000020000_2 and 111121111_2 represent zero, but with different signs. This results in two representations of zero, which is inefficient and can cause confusion.
  • Range of numbers: In an n-bit one’s complement system, the range of representable numbers is (2n11)-(2^{n-1} – 1) to +(2n11)+(2^{n-1} – 1).

For example, in the 4-bit system:

  • Maximum positive value = +(231)=+7+(2^3 – 1) = +7.
  • Minimum negative value = (231)=7-(2^3 – 1) = -7.

Arithmetic Operations in One’s Complement

One’s complement arithmetic involves additional steps due to the presence of two zeros and the bit-inversion technique. Here’s how addition and subtraction work in one’s complement:

Addition Example

Let’s add +5+5 and 3-3 in a 4-bit system using one’s complement.

  1. Find the binary representations:

    • +510=01012+5_{10} = 0101_2
    • 310=11002-3_{10} = 1100_2 (one’s complement of +3+3)
  2. Add the numbers:

    • 01012+11002=1000120101_2 + 1100_2 = 10001_2
  3. Handle the carry:

    • In one’s complement, if there is a carry out (leftmost bit), add it back to the rightmost bit.
    • Here, the carry is 1. So, add 1 to the result: 000120001_2.
    • The final result is 00012=+2100001_2 = +2_{10}.
Subtraction Example

To subtract 33 from 55, we can add +5+5 to 3-3, as shown above.

  1. Find the binary representations:

    • +510=01012+5_{10} = 0101_2
    • 310=11002-3_{10} = 1100_2 (one’s complement of +3+3)
  2. Add the numbers:

    • 01012+11002=1000120101_2 + 1100_2 = 10001_2
  3. Handle the carry:

    • Add the carry to the result: 00012=+2100001_2 = +2_{10}.

The result is +2+2, as expected.

Advantages and Disadvantages of One’s Complement

Advantages:

  • Simplicity: One’s complement is easier to understand and implement compared to two’s complement for small systems.
  • Bitwise operations: The bitwise operations used to invert bits are straightforward and efficient.

Disadvantages:

  • Two representations of zero: The existence of both +0 and -0 can complicate calculations and logic in digital systems.
  • End-around carry: The need to handle end-around carry when adding negative numbers adds complexity to arithmetic operations.
  • Not widely used: Due to its limitations, one’s complement has been largely replaced by two’s complement in modern computing systems.

Comparison with Two’s Complement

  • Two’s Complement: In two’s complement, negative numbers are represented by inverting the bits of the positive number and adding 1. It has only one representation of zero and simplifies arithmetic operations by avoiding the need for end-around carry. This makes two’s complement more efficient and widely used in modern systems.

Conclusion

The One’s Complement Method is a historically important way of representing signed integers in binary form. Although it has largely been replaced by the more efficient two’s complement method, understanding one’s complement is essential for grasping the evolution of binary number systems and their applications in computing. While it offers simplicity in some respects, its drawbacks, such as the dual representation of zero and the complexity of arithmetic operations, have led to its decline in favor of more robust methods.

References

  1. Digital Design: Principles and Practices by John F. Wakerly: This textbook provides an in-depth discussion of number systems, including the one’s complement method, and their applications in digital circuits.
  2. Computer Organization and Architecture: Designing for Performance by William Stallings: This book offers a comprehensive look at computer architecture, including different methods of representing signed numbers like one’s complement and two’s complement.
  3. Computer Architecture: A Quantitative Approach by John L. Hennessy and David A. Patterson: This book discusses various number representation methods, including one’s complement, and their impact on computer performance and design.
  4. Binary Arithmetic – GeeksforGeeks: An online resource that explains the concepts of binary arithmetic, including one’s complement, with examples and detailed explanations. Available at: GeeksforGeeks.

These references provide detailed explanations of the one’s complement method and its place in the broader context of digital design, computer architecture, and binary arithmetic.

Leave a Comment