Mskhanwebsite.weebly.com



Converting between different number bases is actually fairly simple, but the thinking behind it can seem a bit confusing at first. And while the topic of different bases may seem somewhat pointless to you, the rise of computers and computer graphics has increased the need for knowledge of how to work with different (non-decimal) base systems, particularly?binary systems (ones and zeroes) and?hexadecimal systems (the numbers zero through nine, followed by the letters A through F).In our customary base-ten system, we have digits for the numbers zero through nine. We do not have a single-digit numeral for "ten". Yes, we write "10", but this stands for "1?ten and?0?ones". This is two digits; we have no single solitary digit that stands for "ten".Instead, when we need to count to one more than nine, we zero out the ones column and add one to the tens column. When we get too big in the tens column -- when we need one more than nine tens and nine ones ("99"), we zero out the tens and ones columns, and add one to the ten-times-ten, or hundreds, column. The next column is the ten-times-ten-times-ten, or thousands, column. And so forth, with each bigger column being ten times larger than the one before. We place digits in each column, telling us how many copies of that power of ten we need.The only reason base-ten math seems "natural" and the other bases don't is that you've been doing base-ten since you were a child. And (nearly) every civilization has used base-ten math probably for the simple reason that we have ten fingers. If instead we lived in a cartoon world, where we would have only four fingers on each hand (count them next time you're watching TV or reading the comics), then the "natural" base system would likely have been base-eight, or "octal".BinaryLet's look at base-two, or binary, numbers. How would you write, for instance, 1210?("twelve, base ten") as a binary number? You would have to convert to base-two columns, the analogue of base-ten columns. In base ten, you have columns or "places" for?100?= 1, 101?= 10, 102= 100, 103?= 1000, and so forth. Similarly in base two, you have columns or "places" for?20?= 1, 21?= 2, 22?= 4, 23?= 8, 24?= 16, and so forth.The first column in base-two math is the units column. But only "0" or "1" can go in the units column. When you get to "two", you find that there is no single solitary digit that stands for "two" in base-two math. Instead, you put a "1" in the twos column and a "0" in the units column, indicating "1?two and0?ones". The base-ten "two" (210) is written in binary as?102.A "three" in base two is actually "1?two and?1?one", so it is written as?112. "Four" is actually two-times-two, so we zero out the twos column and the units column, and put a "1" in the fours column;?410?is written in binary form as?1002. Here is a listing of the first few numbers:decimal(base?10)binary(base?2)01234567891011121314151601101110010111011110001001101010111100110111101111100000?ones1?one1?two and zero ones1?two and?1?one1?four,?0?twos, and?0?ones1?four,?0?twos, and 1 one1?four,?1?two, and?0?ones1?four,?1?two, and?1?one1?eight,?0?fours,?0?twos, and?0?ones1?eight,?0?fours,?0?twos, and?1?one1?eight,?0?fours,?1?two, and?0?ones1?eight,?0?fours,?1?two, and?1?one1?eight,?1?four,?0?twos, and?0?ones1?eight,?1?four,?0?twos, and?1?one1?eight,?1?four,?1?two, and?0?ones1?eight,?1?four,?1?two, and?1?one1?sixteen,?0?eights,?0?fours,?0?twos, and?0?onesConverting between binary and decimal numbers is fairly simple, as long as you remember that each digit in the binary number represents a power of two.Convert?1011001012?to the corresponding base-ten number.I will list the digits in order, and count them off from the RIGHT, starting with zero:digits: ?1? 0 ? 1? 1? 0? 0? 1? 0? 1numbering: ?8? 7 ? 6? 5? 4? 3? 2? 1? 0The first row above (labelled "digits") contains the digits from the binary number; the second row (labelled " numbering") contains the power of?2?(the base) corresponding to each digits. I will use this listing to convert each digit to the power of two that it represents:1×28?+ 0×27?+ 1×26?+ 1×25?+ 0×24?+ 0×23?+ 1×22?+ 0×21?+ 1×20????= 1×256 + 0×128 + 1×64 + 1×32?+ 0×16 + 0×8 + 1×4 + 0×2 + 1×1????= 256 + 64 + 32 + 4 + 1????= 357???Copyright ? Elizabeth Stape2001-2011 All Rights ReservedThen?1011001012?converts to?35710.Converting decimal numbers to binaries is nearly as simple: just divide by?2.Convert?35710?to the corresponding binary number.To do this conversion, I need to divide repeatedly by?2, keeping track of the remainders as I go. Watch below:Watch below: As you can see, after dividing repeatedly by?2, I ended up with these remainders:These remainders tell me what the binary number is. I read the numbers from around the outside of the division, starting on top and wrapping my way around and down the right-hand side. As you can see:35710?converts to?1011001012.This method of conversion will work for converting to any non-decimal base. Just don't forget to include that first digit on the top, before the list of remainders.?You can convert from base-ten (decimal) to any other base. When you study this topic in class, you will probably be expected to convert numbers to various other bases, so let's looks at a few more examples.Base?4In base four, each digit in a number represents the number of copies of that power of four. That is, the first digit tells you how many ones you have; the second tells you how many fours you have; the third tells you how many sixteens (four-times-fours) you have; the fourth tells you how many sixty-fours (four-times-four-times-fours) you have; and so on. The methodology for conversion between decimal and base-four numbers is just like that for converting between decimals and binaries, except that binary digits can be only "0" or "1", while the digits for base-four numbers can be "0", "1", "2", or "3". (As you might expect, there is no single solitary digit in base-four math that represents the quantity "four".)Convert?35710?to the corresponding base-four number.Then?35710?converts to?112114.Convert?80710?to the corresponding base-four number.Note: Once I got "3" on top, I had to stop, because four cannot divide into?3.Reading the numbers off the division, I get that?80710?converts to?302134.Convert?302134?to the corresponding decimal number.I will list out the digits, and then number them from the RIGHT, starting at zero:digits:?3? 0 ? 2? 1? 3numbering:?4? 3 ? 2? 1? 0Each digit stands for the number of copies I need for that power of four:3×44?+ 0×43?+ 2×42?+ 1×41?+ 3×40?????= 3×256 + 0×64 + 2×16 + 1×4 + 3×1?????= 768 + 32 + 4 + 3?????= 807As expected,?302134?converts to?80710.Base?SevenI can't think of any particular use for base-seven numbers, but they will serve us by providing some more practice with conversions.???Copyright ? 2001-2011 All Rights ReservedConvert?35710?to the corresponding base-seven number.I do the division:Then?35710?= 10207.Convert?1334610?to the corresponding base-seven number.Then?1334610?= 536247.Convert?536247?to the corresponding decimal number.I will list the digits, and count them off from the RIGHT, starting at zero:digits: ?5? 3 ? 6? 2? 4numbering: ?4? 3 ? 2? 1? 0Then I'll do the multiplication and addition:5×74?+ 3×73?+ 6×72?+ 2×71?+ 4×70?????= 5×2401 + 3×343 + 6×49 + 2×7 + 4×1?????= 12005 + 1029 + 294 + 14 + 4?????= 13346Then?536247?= 1334610.OctalAn older computer base system is "octal", or base eight. The digits in octal math are?0, 1, 2, 3, 4, 5, 6, and?7. The value "eight" is written as "1?eight and?0?ones", or?108.Convert?35710to the corresponding base-eight number.I will do the usual repeated division, this time dividing by?8?at each step:Then?the corresponding octal number is?5458.Convert?5458?to the corresponding decimal number.I will follow the usual procedure, counting off the digits from the RIGHT, starting at zero:digits: ?5? 4 ? 5numbering: ?2? 1 ? 0Then I'll do the addition and multiplication:5×82?+ 4×81?+ 5×80???????= 5×64 + 4×8 + 5×1???????= 320 + 32 + 5???????= 357Then?the corresponding decimal number is?35710.HexadecimalIf you work with computer programming or computer engineering (or computer graphics, about which more later), you will encounter base-sixteen, or hexadecimal, math.As mentioned before, decimal math does not have one single solitary digit that represents the value of "ten". Instead, we use two digits, a?1and a?0: "10". But in hexadecimal math, the columns stand for multiples of sixteen! That is, the first column stands for how many units you have, the second column stands for how many sixteens, the third column stands for how many two hundred fifty-sixes (sixteen-times-sixteens), and so forth.In base ten, we had digits?0?through?9. In base eight, we had digits?0?through?7. In base?4, we had digits?0?through?3. In any base system, you will have digits?0?through one-less-than-your-base. This means that, in hexadecimal, we need to have "digits"?0?through?15. To do this, we would need single solitary digits that stand for the values of "ten", "eleven", "twelve", "thirteen", "fourteen", and "fifteen". But we don't. So, instead, we use letters. That is, counting in hexadecimal, the sixteen "numerals" are:0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, FIn other words,?A?is "ten" in "regular" numbers,?B?is "eleven",?C?is "twelve",?D?is "thirteen",?E?is "fourteen", and "F" is fifteen.? It is this use of letters for digits that makes hexadecimal numbers look so odd at first. But the conversions work in the usual manner.Convert?35710?to the corresponding hexadecimal number.Here, I will divide repeatedly by?16, keeping track of the remainders as I go. (You might want to use some scratch paper for this.)Reading off the digits, starting from the top and wrapping around the right-hand side, I see that35710?= 16516.Convert?16516?to the corresponding decimal number.List the digits, and count them off from the RIGHT, starting with zero:digits: ?1? 6 ? 5numbering: ?2? 1 ? 0Remember that each digit in the hexadecimal number represents how many copies you need of that power of sixteen, and convert the number to decimal:1×162?+ 6×161?+ 5×160??????= 1×256 + 6×16 + 5×1??????= 256 + 96 + 5??????= 357Then?16516?= 35710.Convert?6393310?to the corresponding hexadecimal number.I will divide repeatedly by?16, keeping track of my remainders:From the long division, I can see that the hexadecimal number will have a "fifteen" in the sixteen-cubeds column, a "nine" in the sixteen-squareds column, an "eleven" in the sixteens column, and a "thirteen" in the ones column. But I cannot write the hexadecimal number as "1591113", because this would be confusing and imprecise. So I will use the letters for the "digits" that are otherwise too large, letting "F" stand in for "fifteen", "B" stand in for "eleven", and "D" stand in for "thirteen".???Copyright ? 1999-2011 All Rights ReservedThen?6393310?= F9BD16.Convert?F9BD?to decimal notation.I will list out the digits, and count them off from the RIGHT, starting at zero:digits: ?F? 9 ? B? Dnumbering: ?3? 2 ?? 1? 0Actually, it will probably be helpful to redo this, converting the alphabetic hexadecimal "digits" to their corresponding "regular" decimal values:digits: ?15 ?? 9? 11? 13numbering: ?? 3 ?? 2?? 1??? 0Now I'll do the multiplication and addition:15×163?+ 9×162?+ 11×161?+ 13×160???????= 15×4096 + 9×256 + 11×16 + 13×1???????= 61440 + 2304 + 176 + 13???????= 63933As expected,?F9BD = 6393310. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download