Sunday, 21 October 2012

One's complement and two's complement by Sangkirthana

One's complement


One's complement is operation to replace all the 0's to 1's and 1's to 0's.

    For example:                      

                                                (010010)2
   The one’s complement =   (101101)2

its simple as that..

Notes :

  • For one's complement representation the left most bit is 0 for positive number and 1 for negative   number
  • there also representation of both +0 and -0 which are 00000000 and 11111111 respectively.


Two's complement


Two's complement is form just like forming one's complement : complement all of the bit in number, then add 1,
For more understanding:
      Two’s complement = one’s complement + 1
                 


For example:                      
                                                (01101)2
The two’s complement =       10010
                                                +        1
                                                  10011

Notes:
  • For two's complement representation the left most bit is also 0 for positive and 1 for negative number, however this format does not have unfortune characteristic of signed magnitude and one's complement.

No comments:

Post a Comment