Addition and subtraction of binary integers.
1.4.1 Data Types
Data Types — Note 4 of 10
Candidates should be able to perform addition and subtraction on integer binary numbers. (These numbers could be positive or negative using two’s complement representation.)
Binary addition follows simple rules with carries. Subtraction is carried out by adding the two's complement of the number being subtracted, so a computer only needs circuitry for addition.
0+0=0, 0+1=1, 1+1=10 (write 0, carry 1), 1+1+1=11 (write 1, carry 1).The result of a calculation is too large to fit in the number of bits available, so the result is wrong.
45 0 0 1 0 1 1 0 1
+ -20 1 1 1 0 1 1 0 0
---------------
1 0 0 0 1 1 0 0 1 -> discard the carry out of the MSB
Result 0 0 0 1 1 0 0 1 = 25