Understanding n’s Complement

Let us first understand 10’s complement first as it is easy to visualize.
Let us take a car.. Its odometer reads something like 0000 (say). What would you get if you move backward for a km? Well logically speaking the reading is 9999 and we have traveled -1 km. This is exactly what 10’s complement is. If you move another km back we have 9998 and the reading that corresponds to -2 km. Positive movements can be naturally understood. Now let us go on a long trip of 7000km.( long indeed!! ) After reading the odometer how would you convince a person who does not know how long you have traveled or in what direction, that you have travalled 7000km… Will he say that you have traveled -3000km 0r +7000km? This is a concept of overflow. Think of it as all numbers are divided into 2 equal sets and one of them representing +ve and the other -ve numbers. If you have traveled +7000 you have gone out of the range of what can be shown by the car’s odometer and if you have gone -3000km you are within the range.The 2’s complement is just the same as above with the only difference being in the count of binary numbers : 0000 , 0001 , 0010 , 0011 , 0100 , 0101 ….and so on.(+ve) and 1111 , 1110 , 1101 , 1100 …and so on(-ve). Now for sake of uniformity we use all numbers starting withMSB1 as negetive.The same concept can be applied for any base of numbers. If number of symbols in a number system is ,say, 7 then you need 7’s complement to represent -ve numbers without -ve sign. To obtain the 7’s complement we have have to follow the odometer concept as stated above. The counting can be very simple and natural when we have 7 fingers instead of 10 🙂 .
We just have to keep in mind that the negetive numbers are one more than the positive numbers.
The concept of sign extension also becomes clear if you think in these terms.

News Reporter

Leave a Reply

Your email address will not be published. Required fields are marked *