Wednesday 20 November 2013

2’s Complement Number

2’s Complement Number
Property
Two's complement representation allows the use of binary arithmetic operations on signed integers, yielding the correct 2's complement results.
Positive Numbers
Positive 2's complement numbers are represented as the simple binary.
Negative Numbers
Negative 2's complement numbers are represented as the binary number that when added to a positive number of the same magnitude equals zero.

How to Calculate 2's Complement?

For example: -2010

Separate the sign and magnitude number of -1. The sign will be 1 if the number is negative and will be 0 if the number is positive.

Sign

Magnitude

Note

0

  0010100

Now is 20

 

  1101011

Each 0 is changed to a 1 and each 1 is changed to a 0

 

  1101100

Add + 1

1

  1101100

Now is -20

2's Complement Addition

1)    3010 – 2010

3010 = 000111102


-2010 = 111011002

Therefore, 000111102 + 111011002 = 000010102 = 1010









No comments:

Post a Comment