One's Complement
Learn how one’s complement solves the issues related to operations on negative numbers.
We'll cover the following...
Disadvantages of SMR
SMR has two disadvantages. It led to technical issues when computer engineers used this representation in practice. So, engineers started looking for an alternative approach to store numbers in memory. This way, they came to one’s complement representation.
The first problem of SMR is related to operations on negative numbers. The one’s complement solves it. Let’s consider this problem in detail.
The example will explain to us what exactly happens when we operate on negative numbers in SMR. Let’s suppose that we want to add integers 10 and -5. First, we should write them in SMR. We assume that each integer occupies one byte in computer memory. Then, we represent them like this:
10 = 0000 1010
-5 = 1000 0101
Now, the question arises: How does the processor add these two numbers? Any modern processor has a standard module called the adder. It adds two numbers in a bitwise manner. If we apply it for our task, we get the following result:
10 + (-5) = 0000 1010 + 1000 0101 =
...