top of page
  • Writer's pictureStrofl

Binary Arithmetic | Adding, Substracting, Dividing - Qpidi

Binary arithmetic is the foundation of all computer operations. We'll explore the basic operations of addition, subtraction, and division in binary, providing step-by-step examples to illustrate these concepts.


Binary Arithmetic
Binary Arithmetic

What is Binary Arithmetic?

Binary arithmetic is the foundation of all computer operations. At its core, it involves manipulating binary numbers, which are represented using only two symbols: 0 and 1.


Binary Addition

Binary addition is similar to decimal addition but simpler, as it involves only two digits.


Example: Adding 0101 (5 in decimal) and 0011 (3 in decimal).


0101 (5 in decimal)

+ 0011 (3 in decimal)

--------

1000 (8 in decimal)


1- Start from the rightmost bit:

  • 1 + 1 = 10. Write down 0, carry over 1.

2- Move to the next bit:

  • 0 + 1 = 1, plus the carry-over 1 = 10. Write down 0, carry over 1 again.

3- Repeat for all bits:

  • 1 + 0 = 1, plus carry-over 1 = 10. Write down 0, carry over 1.

  • 0 + 0 = 0, plus carry-over 1 = 1. Write down 1.

4- Result: 1000 (8 in decimal).


Binary Subtraction

Binary subtraction uses borrowing, similar to decimal subtraction.


Example: Subtracting 0010 (2 in decimal) from 0101 (5 in decimal).


   0101 (5 in decimal)

 - 0010 (2 in decimal)

 --------

   0011 (3 in decimal)


1- Start from the rightmost bit:

  • 1 - 0 = 1. Write down 1.

2- Move to the next bit:

  • 0 - 1 cannot be done. Borrow from the next bit.

  • 10 (2 in binary) - 1 = 1. Write down 1.

3- Repeat for all bits:

  • After borrowing, the bit becomes 0. So, 0 - 0 = 0. Write down 0.

  • No more subtraction needed. Write down the remaining bit as is.

4- Result: 0011 (3 in decimal).


Binary Division

Binary division is done like long division in decimal.


Example: Dividing 1010 (10 in decimal) by 0010 (2 in decimal).


1- Remove Insignificant Leading Zeros:

  • The divisor 0010 becomes 10.

  • The dividend is 1010.

2- Division Process:

  • First bit: Compare the first bit of the dividend (1) with the divisor (10). Since 1 is smaller than 10, the quotient is 0.

  • Second bit: Bring down the next bit to get 10. Now compare this with the divisor (10). They are equal, so the quotient becomes 1 (current total quotient: 01).

  • Subtraction: 10 - 10 = 00.

  • Third bit: Bring down the next bit to get 001, which is smaller than the divisor. So, the next digit of the quotient is 0 (current total quotient: 010).

  • Fourth bit: Bring down the last bit to get 0010, which is equal to the divisor. So, the next digit of the quotient is 1 (current total quotient: 0101).

  • Final subtraction: 0010 - 10 = 0000. There is no remainder.

3- Conclusion:

  • The quotient of the division is 0101, which is 5 in decimal.

  • There is no remainder.

4 views0 comments

Comments

Rated 0 out of 5 stars.
No ratings yet

Add a rating
bottom of page