Computer Number System: Binary Math Part 1

>
©   Copyright 2009 - 2010 Learning-About-Computers.com  All Rights Reserved.
What are binary numbers? The binary number system  is when only two numbers are used - 0 and 1. It is also called base 2. The computer number system is base 2. Our number system is referred to as decimal or base 10 because we use 10 digits (0 - 9) to form all of our numbers. There are many other number bases, including hexadecimal, but it's easier for computers to utilize 0s and 1s.




In electronics, a 0 is off (usually 0 V) and 1 is on (usually 5 V). All computer data is composed of 1s and 0s. Each individual 1 or 0 is a bit. Four bits is a nibble. Eight bits is a byte. From there we have kilobytes, megabytes, etc. Since everything is a series of 1s and 0s, the CPU has to perform every calculation in binary. But before any operations are done, numbers have to first be converted into base 2.




But before diving into the binary number system and conversions, let's first see how things work in our decimal system.




Let's just pick a number...like 9345. How do we get this? Remember when I mentioned we use base 10? In math the base is a number that's raised to a power ( another name for power is exponent). For example 34 is 3 raised to the 4th power, which means you multiply 3 times itself 4 times (3 * 3  * 3 * 3).




We have what's called a place value system. Each individual number holds a particular numerical position. We get these positions by using 10 raised to different powers. Start with the number on the right.




So looking at 9345, the right-most number 5 is in the ones place
(10º = 1). The 4 is in the tens place (10¹ = 10). The 3 is in the hundreds place (10² = 100), and the 9 is in the thousands place (10³ = 1000). This is true for any number. Now the larger the number the more place values (ten thousands, hundred thousands, etc.), but I'm keeping it short in this example. So we have:



10³     10²     10¹    10º
  9        3        4       5


If you take each number, multiply it by its place value, & add the results, you get 9345.




10º = 1                   1 x 5 =
5                             Note: any number raised to 0 = 1.

10¹ = 10               10 x 4 =
40                                      any number raised to 1 = itself

10² = 100           100 x 3 =
300

10³ = 1000        1000 x 9 =
9000



Now add:
5 + 40 + 300 + 9000 = 9345



This method is used in base 2 except rather than the ones place, tens place, hundreds place, thousands place, etc. you have:

ones place
(2º), twos place (2¹), fours place (2²), and eights place (2³), etc.



Using the base 10 example just above, the number 10112 is like this:


2³     2²     2¹     2º
1      0      1       1



It's the same process for any number system. And remember, the computer number system always uses binary.



So now that you have a basic understanding of place values, it's time to start converting!
 
100110010111
7D2F:FA62
111111111111
4BBC:E101:A240:3123
0010001101110