In the last session, we discussed how negative integer can be coded into binary, specifically the two’s complement representation. This lesson we will have a closer look at how binary arithmetic can be performed and how this could be related to its denary equivalent.

Learning Objectives

Binary Addition

Long long ago, possibly in primary school, we all learned about denary (decimal) addition, and more complicated when there is a ‘1’ being carried over. Once a digit reaches the value 10, it will no longer be held as a single digit, but we “Write 0 and Carry 1”.

As denary is a base-10 number system, we increment 1 (carry 1) when the digit reaches 10; and on the other hand, as binary is a base-2 number system, it will carry 1 once the digit reaches 2. An example is shown as the following:

image.png

For a complicated example on the textbook, it follows the same simple rule.

Let’s have a look at 1011 + 1110

1.jpg

Binary Subtraction

Binary Subtraction works almost the same way as denary subtraction. That means, sometimes, we need to borrow. In denary, if we borrow from a higher digit, it turns into 10 on the lower digit; but in binary, as it is base-2 number system, it will be turned into 2. An example can be seen as the following:

image.png