For unsigned number computations, no need to add one more additional bit for computations or calculations.
But, while doing signed numbers computations (-ve numbers), Then we need to add one more bit for signed representation.
Then the total area, power, the cost will be more, due to increasing of area.
To solve this problem, the alternate method is "complements".
The complement is used for representing 'the negative decimal number in the binary form'. Different types of complement are possible of the binary number, but 1's and 2's complements are mostly used for binary numbers.
Generally, they are r's and (r-1)'s complement is possible, but
r---> should be is even number
Addition rules:
subtraction rules:
for subtractions :
the complements are registers, especially for converting signed numbers.
for signed numbers converting can be done by using either r's and (r-1)'s complements
Generally,1's complement and 2's complement,9's complement, and 10's complement are popular for doing subtractions.
1's complement :
1's complement is used for representing the negative decimal number in binary form. Different types of complement are possible of the binary number, but 1's and 2's complements are mostly used for binary numbers. We can find the 1's complement of the binary number by simply inverting the given number.
example :
For finding 1's complement of the given number, change all 0's to 1 and all 1's to 0. So, the 1's complement of the number 100110.1001 comes out 011001.0110.
Adding Positive & Negative Numbers in Ones Complement
1's Complement of Base-2 :
- All 0's become 1's
- All,1's become,0's
example :
(10110000)2
(01001111)2
ans:1 1 1 1 1 1 1 1
2's complement :
2's complement is the binary number by changing each bit(0 to 1 and 1 to 0) and adding 1 to the least significant bit.
example :
2's complement of binary number 1011001 is (0100110)+1=0100111.
Comments
Post a Comment