Continued from Last Week's Post
This is the continuation of last week's article, Learn the Binary Number System
Last week, we went through the fundamentals of the Binary Number System, learned how to convert the decimal number 10 to binary, and used different ways to convert a decimal number to Binary.
I hope you have tried converting the sample number 255 yourself.
If you could not do it, then let us try it here.
Method-1:
Find the highest integer value in the binary table that can be subtracted from the Decimal Number. Here, 128 is the highest value that can be taken.
Write the binary digit 1 at the 128 (27) number position underneath the Binary Table.
The next highest integer in the binary Table that goes into 127 is 64.
Repeat this method up to the unit Value position.
| 255 |
| -128 |
| =127 |
| 215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| 32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 |
| 127 |
| -64 |
| =63 |
| 215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| 32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 1 |
| 215 | 214 | 213 | 212 | 211 | 210 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 |
| 32,768 | 16,384 | 8,192 | 4,096 | 2,048 | 1,024 | 512 | 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
You can cross-check the result by adding up all values taken from the 1s bit (the name of the binary digit) position to arrive at the total value you were trying to convert into Binary.
Method-2:
Divide the decimal number by 2, take the remainder, and write it at the unit position in the Binary Table.
255/2 = Quotient = 127, Remainder = 1
- Next step, take the Quotient Value (127) of the previous calculation, divide it by 2, and find the remainder. Write the remainder value to the left of the earlier written binary digit (bit). Repeat this method and write the final remainder in the binary table.
127/2 = Quotient = 63, Remainder = 1
63/2 = Quotient = 31, Remainder = 1
31/2 = Quotient = 15, Remainder = 1
15/2 = Quotient = 7, Remainder = 1
7/2 = Quotient = 3, Remainder = 1
3/2 = Quotient = 1, Remainder = 1
1/2 = Quotient = 0, Remainder = 1
You will get the Binary Number 11111111 equal the Decimal Number 255.
You can experiment with larger decimal values or write some unknown Binary Values with random 1s and 0s and try converting them back into Decimal Numbers.
Next, let us try some additions and subtractions with Binary Numbers. If you know the rules of Decimal addition and subtraction, then you have no problems with Binary Numbers.
Example: Addition
| 11101110 | 238 |
| +1110111 | 119 |
| 101100101 | 357 |
Start adding the rightmost digits:
0+1 = 1
Next 1+1 = 2, put 0 and carry 2 to the next position (like 5+5=10, we put 0 at the unit's position and carry 1 to the next position to add)
next 1+1+1 carry = 3 (binary 11), put 1 and carry 2 to the next position
next 1+1 carry = 2(binary 10), put 0 and carry 2 to the next position
Next 1+1 carry = 2(binary 10), put 0 and carry 2 to the next position
Next 1+1+1 carry = 3(binary 11), put 1 and carry 2 to the next position
Next 1+1+1 carry = 3(binary 11), put 1 and carry 2 to the next position
Next 1+1 carry = 2(binary 10), put 0 and carry 2 to the next position.
Example: Subtraction
| 11001110 | 206 |
| -1111111 | 127 |
| 1001111 | 79 |
- 0-1 cannot be done, so take 2 from the next position; now 2-1 = 1, but the next position on the first line becomes 0.
0-1 cannot be done, so take 2 from the next position; now 2-1 = 1, but the next position on the first line becomes 0.
0-1 cannot be done, so take 2 from the next position; now 2-1 = 1, and the next 3 positions become 0.
Take the value from the 8th position and move forward to the 4 positions and to the 2 value position; 2-1 = 1
1-1 = 0
1-1 = 0
After moving the value forward from the 7th digit position on the top line, it is now 0. So move 2 from the next position. 2-1 = 1
You can try it out yourself, starting with smaller binary values and progressively with bigger ones.
For your information, there is no Multiplication or Division in computers. These calculations are achieved by successive addition or subtraction of values.
Continued../-








There are a couple of practice quizzes here. Repetition helps.
ReplyDeletehttp://plentysmart.com/comp/bin1/binary1.php