Translate

Thursday 7 June 2012

Signed Binary Numbers: One's Complement Representation

In a binary number, if each 1 is replaced by 0 and each 0 by 1, the resulting number is known as the one's complement of the first number. In fact, both the numbers are complement of each other. If one of these numbers is positive, then the other number will be negative with the same magnitude. For example, (0101)2 represents (+5)10, whereas (1010)2 represents (-5)10 in this representation. This method is widely used for representing signed numbers. In this representation also, MSB is 0 for positive numbers and 1 for negative numbers. 

Exercise 1
Find the one's complement of the following binary numbers.

  1. 0100111001
  2. 11011010
Solution:

1) 1011000110
2) 00100101

Exercise 2
Represent the following numbers in one's complement form.
  1. +7 and -7
  2. +8 and -8
  3. +15 and -15
Solution:

1) (+7)10 = (0111)2 and (-7)10 = (1000)2
2) (+8)10 = (01000)2 and (-8)10 = (10111)2
3) (+15)10 = (01111)2 and (-15)10 = (10000)2


No comments:

Post a Comment