Tuesday, 7 February 2012

Number Representation


Sign-Magnitude form:
  •  MSB is used to represent sign and remaining bits are used to represent magnitude.
  •  ‘0’ represents +ve, ‘1’ represents –ve.
  • Ex: +6 = 0110   (MSB is ‘0’ hence +ve )
  • -6 = 1110  (MSB is ‘1’ hence –ve)
1’s complement form:
  •  Positive numbers are represented as in sign magnitude form
  • Negative numbers are represented by complementing each bit in sign magnitude form except sign bit.
  •  Ex: +6= 0110
  • -6= 1001 (in sign magnitude form -6 is 1110, to get 1’s complement, complement underlined bits)
2’s Complement form:
  • Positive numbers are represented as in sign magnitude form
  • Negative numbers are represented by complementing each bit after first non-zero bit in sign magnitude form (except sign bit)
  • Ex:+6=0110
  • -6 = 1110(sign-magnitude form)
Underlined bit is first non-zero bit (from right to left), up to that bit sign-magnitude form and 2’s complement form are same, remaining bits should  be complemented except sign bit. Thus 1010 is 2’s complement form of -6
 
  • 2’s complement of a number can also obtained by adding ‘1’ to the 1’s complement of the number.
9’s complement:
9’s complement of a number can be obtained by subtracting each digit from 9.
Ex: 9’s complement of 653 = 346
10’s complement:
10’s complement of a number can be obtained by subtracting right most digit from 10, and remaining digits from 9. Otherwise 10’s complement of a number can be obtained by adding 1 to the 9’s complement of the number.
Ex: 10’s complement of 653 is 347
Note:
  •  R’s complement of a number ‘N’ consisting of ‘n’ digits is rn-N
  • (R-1)’s complement of a number ‘N’ consisting of ‘n’ digits is rn-N-1
Back                                              Contents                                               Next

No comments:

Post a Comment