Complements of Binary Numbers
When we are trying to work with any kind of digital electronics in which numbers are being represented, what we should take in mind is that it is important for us to understand the different ways numbers are represented in these systems. Almost without any type of fail,these numbers among one are represented by the two voltage levels which can be represented by one or zero. The number system are based on ones as well as the zeroes which is called the binary system just because there are only two possible digits in the form. Before we have been discussing about the binary system,we have to know that the review of the decimal which is known to be the ten possible digits of a system is in order as many of the concepts of the binary system will be found easier to be understood when we introduce their counterpart of decimal.
You should also be familiar with the decimal system. For example, in order to represent the positive integer suppose one hundred and twenty-five in the form of a decimal number then you will be able to write it with the positive sign. The subscript 10 indicates the required number as a base 10 that is the decimal number.
12510= 1*100 + 2*10 + 5*1 = 1*102+ 2*101+ 5*100
Here, the digit in the rightmost order is multiplied by 100, and again the next digit which is to the left is to be multiplied by 101, and the operation goes on. Each of these digit which are to the left is found to have a multiplier which is 10 times of the previous digit. Here are some of the observations of the provided values.
If you have to multiply a number by 10 then you can shift the number simply to the left by one digit and can fill it in the rightmost digit with 0 by moving the decimal place one to the rightward corner.If you need to divide any number by 10 again, you need to shift the number to the right simply by one digit that is you can move the decimal place one in the left.
Again if you want to see how many of the digits a number needs then the thing you should do is to simply take the logarithm (take in mind that you need base 10) of the absolute value of the required number and just add 1 to the number. The integer part of the required result is the given number of digits. For example,log10(33) + 1 = 2.5.
The integer part of that is 2, so you need 2 digits.
If you are working with the n digits then 10n10 unique numbers i.e. from 0 to 10n-1 can be represented generally. Again, if we have n=3, then 1000 (=103) numbers can be represented as 0-999.
The Negative numbers can also be handled in a simple way by putting a minus sign (-) in front of the required number. This leads to the awkward situation sometimes where sometimes it occurs as 0=-0.In such cases, we should avoid this kind of the situation with the binary representations but we need a little bit of the effort in it.
When we say one's complement then it refers that the complement or opposite of +2 is −2. When we represent positive as well as the negative numbers in 8-bit one's complement binary form then it is known that the positive numbers are as same as in the signed binary notation described ini.e. it is clearly known that the numbers from 0 to +127 are to be represented as 000000002to 011111112. But, it shows that the complement of these numbers i.e. their negative counterparts from −128 to −1 which are to be represented by ‘complementing’ each 1 bit of the positive binary number to 0 and 0 to 1 each.
For an example
You should be Noticing from the above example that the most significant bit that is the msb in the negative number −510is 1 same to that as in the signed binary form. Here, the remaining of the 7 bits of these negative number is not found to be same as in signed binary numbers. They are known to be the complement of the remaining 7 bits and these numbers are to be given the value or magnitude of the number.
Two’s complement is known to be solving the problem of the relationship between the given positive as well as the negative numbers hereby achieving the accurate results in subtractions.
In order to perform any of the binary subtractions then the twos complement will most probably use the technique to complement the number to be subtracted. However, in the ones complement system result that was 1 less than the correct answer was produced but we could correct this by using the end around carry process. There still occurs a problem that the given positive, as well as the negative versions of the same number, did not produce zero when they were added together.
This twos complement system should be overcoming both of these problems by adding one to the one's complement simply before an addition takes place.
We should take in a note that in twos complement the 1 carry from the most significant bit needs to be discarded since there occurs no such need for the end around carry.
Where we find the numbers that are electronically stored in the twos complement form then we can carry out the subtractions more easily as well as faster as the microprocessor has to add two numbers together simply by using nearly the same circuitry as it is to be used for the addition.
6 − 2 = 4 is the same as (+6) + (−2) = 4
Another example of the twos complement form
Floyd, Thomas l. Digital Fundamentals. USA: pearson education international, 2006.
Morris mano digital desgin.
CAVANAGH, J.J. , Digital Computer Arithmetic, NewYork: McGraw-Hill 1984.