Reply
Sat 9 Sep, 2006 01:42 pm
For example, below is the 6 bit binary numbers have a sign in the leftmost position and are expressed in 2's complement form.
001010+100010
I am not sure 2's complement is invert the binary number then plus one?
So the arithmetic operation 001010+100010 how do I perform?
To complement the second binary number izzit?
Or both can be add directly?
Hope expert could guide. Thanks.
Just add the numbers.
001010
100010
--------
101100
Since bit 5 is a 1, the number is negative. To figure out what that number is, invert and add 1.
010011
000001
--------
010100 = 20
So, the result is -20. This can be verified by converting the original numbers to decimal. The first is 10, and the seconds is -30 (invert and add 1 then convert to decimal).