For
example +5 is denoted by 0,101.
0
: show that the number is positive
1:
show that the number is negative
Ones
compliment
In
ones compliment system the representation of positive number is the
same as that of sign magnitude system. But the representation of
negative number is different.
For
example -5 is represented in ones compliment as 1,010. This is
obtained by replacing all the 1s by 0 and zero by 1 in the binary
representation of +5 which is 0,101.
The
process of replacing a 0 by 1 and 1 by 0 is called bits
complimenting.
In
general a n bit number x's (with out sign bit) ones compliment is
given by (2^n-1-x).
Twos
compliment
The
twos compliment is obtained by adding 1 to the ones compliment of a
number.
Example:
+5=0,101
-5=1,010
(1s compliment)
now
twos compliment of -5 is 1,010 + 0001 = 1,011
In
general for an n bit number twos compliment is given by 1,(2^n-x).
Another method to to find the twos compliment of a binary number is
to scan the number from left to right and compliment all the bits
appearing after the first one. An example I given below.
0,1110
→ 1,0010
No comments:
Post a Comment