* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Binary Numbers
Survey
Document related concepts
Transcript
Binary Numbers Press any key to begin. In order to understand the binary numbering system lets first look at our decimal system. • The decimal numbering system consists of the numbers 0 through 9. • After nine we place a 1 in the tens column and start again with 0. Which gives us 10. • The decimal system is also known as base 10 because it is based on the 10 numbers 0 – 9. 0 1 2 3 4 5 6 7 8 9 1 0 Press any key to continue… Binary Numbers have only two digits 0 or 1 Binary is known as Base 2 Decimal Binary 0 0 1 1 2 10 3 11 4 100 5 101 6 110 7 111 Press any key to continue… As you can see it would take a lot of time to create charts to represent Binary numbers. An easier way is to use the powers of 2 20 = 1 21 = 2 22 = 4 24 = 16 25 = 32 26 = 64 23 = 8 27 =128 Lets place the above calculations into a chart that will make it easy to convert a binary number to a decimal number. 27 26 25 24 23 22 21 20 128 64 32 16 8 4 2 1 Press any key to continue… Use the chart to convert the binary number to decimal. 27 128 26 64 25 32 24 16 23 8 22 4 21 2 20 1 0 0 1 0 1 0 0 1 1 2 4 x x x 1 0 0 = = = 8 16 32 x x x 1 0 1 = 8 = 0 = 32 64 128 x x 0 0 = = Total 1 0 0 0 0 = 41 Note: The bit to the far right is the Least Significant Bit (LSB) and will determine if the number is even or odd. Press any key to continue… Use the chart to convert the binary number to decimal. 27 128 26 64 25 32 24 16 23 8 22 4 21 2 20 1 0 1 1 1 1 1 1 1 = = = 1 1 1 1 = = = = 1 1 2 4 8 16 32 64 1 8 16 32 64 1 x x x x x x x 128 x 0 = 0 1 2 4 Total = 127 Note: if consecutive bits from the right are all 1’s Then the answer is the next power of 2 minus 1 In this case 128 – 1 = 127 Press any key to continue… Take a piece of paper and convert the binary number to decimal. Press any key when you have the answer. 27 128 26 64 25 32 24 16 23 8 22 4 21 2 20 1 1 0 1 1 1 0 1 0 1 2 4 x x x 0 1 0 = = = 8 16 32 64 128 x x x x x 1 1 1 0 1 = 8 = 16 = 32 = 0 = 128 Total 0 2 0 = 186 Press any key to continue… The largest number that can be represented using an 8 bit binary number is 255. 28 27 256 128 1 26 64 25 32 24 16 23 8 22 4 21 2 20 1 1 1 1 1 1 1 1 Remember the rule – if all the digits are 1 then the number is the next power of 2 minus 1 256 – 1 = 255 Converting a binary number to a decimal number is a simple task if you understand the chart below and how to use it. 27 128 26 64 25 32 24 16 23 8 The End 22 4 21 2 20 1