You are on page 1of 11

LESSON 4.

2
BINARY ARITHMETIC OPERATIONS

Binary arithmetic is used in digital systems because numbers (decimal and


floating-point) are placed in binary format on almost all computer systems. The binary
representation of numbers uses four-arithmetic operations such as addition,
subtraction, multiplication, and division. It is necessary to understand the
representation of binary numbers to know binary arithmetic in digital computers.

In most arithmetic and logic unit (ALU) hardware, the operating numbers are
stored in a fixed number of bits. Therefore, an exact limit or error is performing binary
arithmetic on computers, and this binary arithmetic is called fixed-precision arithmetic.

We will discuss binary arithmetic from the logic design perspective in this part
of the module. In this part of the discussion, you should know four basic arithmetic
processes to understand the binary arithmetic operation easily.

Arithmetic Operations

Arithmetic is the mathematics of integers, rational numbers, real numbers, or


complex numbers under addition, subtraction, multiplication, and division.

4 Arithmetic Operations
1. Binary Addition

2. Binary Subtraction

3. Binary Multiplication

4. Binary Division

▪ Note that in binary, there are only 2 numbers involved, 1 and 0.

Binary Addition
▪ The rules are:
➢ 0 + 0 is equal to 0
➢ 0 + 1 is equal to 1
➢ 1 + 0 is equal to 1
➢ 1 + 1 is equal to 1 0
FUNDAMENTALS OF COMPUTING 2020

Step by Step Procedure in Binary Addition

Step 1 — In the first step, we must write two binary numbers. Write one number in the
top to another number. The alignment should be made appropriately.
Step 2 — In the second step, we must start from the right side. Then we can add the
two binary numbers.
Step 3 — If any carry comes means, it must be added to the next digit numbers.
By using the following rules, we can do the binary addition.

Example 1: Solve for the sum: 1101 + 1111

Solution:

Step 1 1 1 0 1
Arrange the given. + 1 1 1 1

Step 2

REMAINDER
1
1 1 0 1 Note that in the binary addition rules
+ 1 1 1 1 1+1=0 provided that you will add 1 as
0 remainder on the upper part of the
next column on the left side.

Step 3 The remainder 1 in step 2 will


become a part of the next column on
1 the left side in step 3. Go back to the
1 1 0 1
binary addition rules, it indicates
+ 1 1 1 1
there that 1 + 0 = 1.
0

1 1 REMAINDER
1 1 0 1 Since 1 is the answer on the first two
1
rows on the second column, you will add
+ 1 1 1 1
the binary number on the third line which
0 0
is also 1. Note that 1 + 1 = 0 remainder
1 on the upper part of the next column
on the left side.

Angeles, Baldevarona, Galvez 69


FUNDAMENTALS OF COMPUTING 2020

REMAINDER
The remainder 1 on the previous step will
1 1 1 become a part of the next column on the left
1 1 0 1 side. Go back to the binary addition rules, it
1
+ 1 1 1 1 indicates there that 1 + 1 = 0 if you will add 1 as
0 0 remainder on the upper part of the next column
on the left side.

1 1 1
1 1 0 1 Since 0 is the answer on the first two
0 1 rows on the third column, you will add
+ 1 1 1 1 the binary number on third line which is
1 0 0 1. Note that 0 + 1 = 1.

REMAINDER
The remainder 1 on the previous step will become
1 1 1 1 a part of the next column on the left side. Go back
1 1 0 1 to the binary addition rules, it indicates there that 1
0 1 + 1 = 0 if you will add 1 as remainder on the upper
+ 1 1 1 1 part of the next column on the left side.
1 0 0

1 1 1 1
1 1 0 1 Since 0 is the answer on the first two rows
0 0 1 on the fourth column, you will add the binary
+ 1 1 1 1 number on the third line which is 1. Note that
1 1 0 0 0 + 1 = 1.

1 1 1 1
1 1 0 1
0 0 1 Last step brings down the remainder on the
+ 1 1 1 1 fifth column. If ever that the next column has
1 1 1 0 0 no binary number, it assumes that there
exist a binary number which is 0.

1 1 1 1
1 1 0 1 The final answer for 1101
0 0 1 plus 1111 is equal to 11100.
+ 1 1 1 1
1 1 1 0 0

Angeles, Baldevarona, Galvez 70


FUNDAMENTALS OF COMPUTING 2020

Example 2: Find the sum: 101111 + 111000 =

Solution:
Step 1
Arrange the given.
101111
+ 111000

Step 2

101111 Note that in the binary addition rules


+ 111000 1+0=1.
1

Step 3
Continue the process according to the
101111 rule: 1 plus 0 is 1 and it is the same
+ 111000 scenario until the third column from right
11 1 to left.

Remainder: 1 On the fourth column from right to left, we


101111 have 1 plus 1, the answer must be 0 if we
+ 111000 will add remainder 1 to the next column
01 11 on the left.

Remainder: 11 On the fifth column from right to left,


101111 there is a remainder from the previous
1 column, 1 (remainder) plus 0 is 1, note
+ 111000 that there is still to be added which is 1.
00111 1 plus 1 is 0 provided that will add
remainder to the next column on the left.

Angeles, Baldevarona, Galvez 71


FUNDAMENTALS OF COMPUTING 2020

On the last column from right to left, there


is a remainder from the previous column,
1 (remainder) plus 1 is 0 provided that
will add remainder to the next column on
the left.
Remainder: 111
101111 Also, note that there still needs to be
01 added which is 1. 1 plus 1 is 0 provided
+ 111000 that will add remainder to the next
111111 column on the left.

Since the answer on the last step is 0 we


will add the last value which is 1, 0 plus
1 is 1.

And finally, since the last remainder does


Remainder: 111 not have any binary number to be add we
101111 will just bring it down as it is.
01
+ 111000 The final answer is 1111111.
11 1 1 1 1 1

Binary Subtraction

Binary subtraction is to be performed by using binary addition. The subtraction of


binary numbers is done in the 2-complement notation and then adding the numbers to
reduce complexity. The rules are:

➢ 0–0=0
➢ 1–0=1
➢ 1–1=0
➢ 0 – 1 = 1 (with a borrow of 1)

Step by Step Procedure in Binary Subtraction


Step 1 — In the first step, we must write two binary numbers. Write one number in the
top to another number. The alignment should be properly made.

Step 2 — In the second step, we must start from the right side. Then we can subtract
the two binary numbers.
Step 3 — If "0 minus 1" exist, then the answer is 1 if you will borrow 1 on the next
column on the left side.

Angeles, Baldevarona, Galvez 72


FUNDAMENTALS OF COMPUTING 2020

By using the following rules, we can do the binary subtraction.

EXAMPLE 1: Subtract. 1101 – 1011 =

Solution:
Step 1

Arrange the given.


1 1 0 1
- 1 0 1 1

Step 2

1 1 0 1 By looking back to the


binary subtraction
- 1 0 1 1 rules, 1-1 = 0.
0

Step 3

0 10 In the binary subtraction rules,


1 1 0 1 0 – 1 = 1 provided that 0 can
borrow to the fist row on the
- 1 0 1 1 next column.
1 0 So now 0 will become 10 and
1 the binary number next to it
will become 0.

0 10
1 1 0 1 Since 0 borrow 1 from the third
column first row it now
- 1 0 1 1 becomes 0. By looking back to
0 1 0 the binary subtraction rules, 0
– 0 = 0.

0 10
1 1 0 1
Lastly, 1 – 1 = 0.
- 1 0 1 1
0 0 1 0

0 10
1 1 0 1
The final answer for 1101 minus
- 1 0 1 1 1011 is equal to 0010.
0 0 1 0

Angeles, Baldevarona, Galvez 73


FUNDAMENTALS OF COMPUTING 2020

Example 2: Find the difference. 1001 – 1110 =

Step 1
Arrange the given. 1 0 0 1
- 1 1 1 0
Step 2
1 0 0 1 By looking back to the
binary subtraction
- 1 1 1 0 rules, 1-0 = 1.
1

Step 3
In the binary subtraction rules, 0
0 10
– 1 = 1 provided that 0 can borrow
1 0 0 1
to the first row on the next
- 1 1 1 0 column. So now 0 will become
1 1 10.

0 1 10
The next 0 will borrow to the
1 0 0 1
binary number next to it which is
- 1 1 1 0 1, so the second 0 which is the
0 1 1 second borrower will become 1
and the last binary number 1 will
become 0.
0 1 10
0 – 1 = 0: according to the rule the
1 0 0 1
answer is 0 but it cannot be done
- 1 1 1 0 by just putting the binary number
0 1 1 0 as the answer on the last
column because the rule also
indicates that the answer will only
become 0 provided that it can
borrow to the binary next to it. But
there’s no binary number follows.
When it happens, there is an
0 1 10 alternative solution.
1 0 0 1 Disregard if no more digit on the
- 1 1 1 0 next column, get the opposite bit
0 1 1 then add one (1).

1 0 0 Add the negative sign to your final


answer. That is the pattern every time
+ 1 you encounter this kind of problem.
-1 0 1 The final answer is – 101.

Angeles, Baldevarona, Galvez 74


FUNDAMENTALS OF COMPUTING 2020

Binary Multiplication

Binary multiplication is much simpler than decimal multiplication. In the case of


decimal multiplication, we need to remember 3 x 9 = 27, 7 x 8 = 56, and so on. In
binary multiplication, we only need to remember the following:

➢ 0x0=0
➢ 0x1=0
➢ 1x0=0
➢ 1x1=1

Step by Step Procedure in Binary Multiplication

Step 1: In the first step, we must write two binary numbers. Write one number in the
top to another number. The alignment should be appropriately made.
Step 2: In the second step, multiply the first column in the second row to all the bit
entry on the first row like the decimal multiplication process.

Step 3: Repeat step 2 until the last multiplier of bit on the second row.
By using the following rules, we can do the binary multiplication.

Example 1: Solve for the product. 1011 x 1101 =

Solution: 1 0 1 1
Step 1 X
1 1 0 1
Arrange the given.

Step 2 Multiply the second row


1 0 1 1 to the first row from right
X
to left.
1 1 0 1
1 0 1 1
Since the first multiplier is
1, you just need to copy
the first column as is.

Step 3 Next is multiply the


1 0 1 1 second row to the second
X
row.
1 1 0 1
1 0 1 1 Since the multiplier is 0, all the entry
00 0 0 on the second line of the answer is all
0. And as you can see, the answer is
one unit moved to the left.
Angeles, Baldevarona, Galvez 75
FUNDAMENTALS OF COMPUTING 2020

Do the process until the


1 0 1 1 last multiplier on the
X
second row.
1 1 0 1
1 0 1 1 If the multiplication process is done,
00 0 0 then add all the bits you computed to
101 1 get the final answer.
1011

1 0 1 1
X
1 1 0 1
1 0 1 1
1
00 0 0
1
101 1 Using the binary addition rules, you’ll
1
get the final answer of 10001111.
1011 _
10001 1 1 1

Example 2: Find the product: 11111 x 101 =


Solution:
Step 1
11111 Arrange the given.
x 101
Step 2 Follow the multiplication rules, multiply
11111 the multiplicand to the multiplier one by
x 101 one.
11111
The first multiplier is 1; if the multiplier is
1 you simply copy the multiplicand.
Step 3
11111 The second multiplier is 0, so all the
x 101 answer is zero (0). Write your answer
11111 one unit ahead to the left.
00000
11111
x 101 The last multiplier is 1, so obviously, you
11111 just need to copy the multiplicand.
11111
00 Write the answer one unit ahead on the
00000 previous quotient, and lastly, get the sum
+ 1 1 1 1 1___ for the final answer.
10011011

Angeles, Baldevarona, Galvez 76


FUNDAMENTALS OF COMPUTING 2020

Binary Division
The binary numbers' division process is carried out in the simple division,
while the binary numbers are subtracted in their 2 - complemented notations.

Example 1: Find the quotient. 111011 ÷ 11 =

Solution:
ANSWER
1 If you look back to the
11 111011 definition, it’s written there that
it is done by simple division.
You only need to justify if the
divisor is fitted to the dividend,
if yes, the answer will be 1.

DIVISOR ANSWER
1 Multiply the answer to the
11 111011 divisor to move on to the next
1 1
step. The answer should be at
the lower part of the dividend.

1
11 1 1 1 0 1 1
1 1 _ Subtract the answer to the
0 0 1 dividend. If the answer is all 0,
then it is better not to write it
and move to the next bit.

ANSWER
10011
11 1 1 1 0 1 1
1 1 _ Do the same processes
1 until you reach the last bit of
0 _ the dividend.
10
0 _
10 1
1 1_
1 0 1
1 1 If the last answer is not all
1 0 0, then it will declare as
remainder.
FINAL ANSWER: 10011 r. 10

Angeles, Baldevarona, Galvez 77


FUNDAMENTALS OF COMPUTING 2020

Example 2: Find

the quotient: 1100 ÷ 100 =

Solution:

1
Divide 1100 by 100; since the divisor has
100 1100 3 digits only, we will use the first 3 digits
of the dividend. The dividend 110 is
divisible by 100, so the answer is 1.
1
Multiply your answer to the divisor, write
100 1100 the quotient under the dividend
1 0 0__ accordingly, and subtract the dividend
100 quotient.

After those steps, bring down the last


digit of the dividend.

11
Repeat the steps, divide the present
100 1100 dividend to the divisor. The dividend 100
1 0 0__ is divisible by 100, so the answer is 1.
100

11 Multiply your answer to the divisor, write


the quotient under the present dividend
100 1100 accordingly, and subtract the present
1 0 0__- dividend quotient.
100
100 The final answer is 11.
0

Angeles, Baldevarona, Galvez 78

You might also like