Base 8 - the best number system. So long, Base 10! Back to index of science pages by Donald Sauter. Base 8 - the Best Number System! Right off the bat let me pull the rug out from under you and freely admit myself that this idea probably won't be implemented tomorrow. Looks like Base 10 kind of has a toehold. Still, that shouldn't hold us back from the fun of thinking and comparing and analyzing. Nothing's impossible, and the adoption of Base 8 some day by some civilization is quite a few steps up from unthinkable. Suppose, for example, some four-fingered aliens or, more horrifying yet, another French Revolution, came along and forced it on us, along with 10-day weeks and 1000-day years, shudder, shudder. (Well, at least the former scenario can be proven to be impossible - see my "Human Race is Special" page.) We humans are "binary" creatures. By that I mean that we can only reliably double and halve quantities using our senses. To be honest, I'm really only referring to lengths here, but that's one of our most common and fundamental measurements.

If you have a stick, or a board, or the edge of a table, or a wall, or a column of water, etc., you can reliably put your finger on the midpoint. You'll know you have it right because if you didn't there would be a visible imbalance between the two sides. So far, that doesn't sound like a big deal; you can hit the midpoint whether you're living in a Base 10 world, where the halfway mark is called .5, or a Base 8 world, in which it's called .4 (because 4 is half of 8.) But in Base 8 you can continue halving halves to zoom in on any number that can be written. For example, suppose you needed to mark the .31 spot on this unit length: ________________________________________________________________ We concentrate first on locating .3 . The halfway point is .4 : _______________________________|________________________________ .4 We find .2 halfway between 0 and .4 : _______________|_______________.________________________________ .2 And .3 is halfway between .2 and .4 : _______________._______|_______.________________________________ .3 Now we go for the second digit.

We split .3 and .4 to get .34 : _______________._______.___|___.________________________________ .34 We find .32 halfway between .3 and .34 : _______________._______._|_.___.________________________________ .32 And, finally, we nail .31 halfway between .3 and .32 : _______________._______.|._.___.________________________________ .31 Imagine that, two-place precision without any sort of measuring device! And with the point of your pen, you could take it to another place, such as .316. If you haven't thought about this before, you should be pretty impressed. And remember, what we just did could be done for any number expressed octally. Even if we were given a number with many digits after the decimal point (I know I'm using a lot of Base 10 terminology here) we would very quickly zoom in on the spot where our fingertip doesn't move anymore. On the other hand, what we just did cannot generally be done in Base 10. That requires guesswork.

You can only take a stab at the .1, .2, .3, .4, .6, .7, .8, or .9 spots. Yes, you can nail the numbers that occur naturally in Base 8, such as 1/2 (.5), and multiples of 1/4 (.25), 1/8 (.125), etc., but just those few. Think about the times when you've needed to find the .7 spot between the smallest divisions of some scale. I'll bet what you do is two quick halvings to get to .75 and then say, "Ok, it's a little less than that." If you needed .8, you would move up "a little" from .75 . (By a similar process of doubling we could quickly construct any desired length greater than 1 using the unit length. But I don't think this has as much practical significance, and notice that what we would do in Base 10 borrows directly from the binary method, anyhow, always being mindful of the powers of 2.

For instance, if you needed to construct a length of 19 from a unit, you would do four doublings to get to 16, add on a single doubling to get 18, and then add on one unit. In Base 8, the representation for 19 is 23, which shows directly that we need 2 x 8, plus 3 units.) In third grade the teacher had us folding paper into fractions. Getting exact halves was a cinch, but when Mrs. Koehler challenged us to fold a piece of paper in thirds, I got very frustrated. In Base 8, 1/3 is .252525..., and by continual halvings you can zero in on that. (I just did an experiment - with excellent results. So there.) The point of this is, and I wish I could conjure up the most compelling words, is that in Base 8 we can connect every number to the real world just using our guts. This is only true for number systems based on powers of 2, so it would also be true for number systems based on 2, 4, and 16.

I don't think I'd get much of an argument by saying that Base 8 represents the best compromise between the purity of Base 2 and the compactness and convenience of Base 10. In fact, moving from Base 10 to Base 8 would hardly give rise to the need for more digits. Two octal digits are almost as precise as two decimal digits. I suppose someone could put my feet to the fire and argue that our senses are capable of dividing into thirds as well. But that would take both hands to mark the third-way points, require much more time and effort to gauge the equalness of the three segments, and yield correspondingly less reliable results. (I just tried it on a piece of paper and missed by a mile. So there.) Notice how builders naturally went for the binary system of halving halves. An inch is divided into halves, quarters, eighths, sixteenths, thirty-secondths, and sixty-fourths. A superb idea but, with all due respect, the fractional notation is strictly for the birds. All those numbers would look great in Base 8.

A really messy one like 37/64, which is .578125 in decimal notation, works out to a slim and trim .45 in octal notation. A nice side benefit of Base 8 is that the multiplication table is 64% as big as the Base 10 multiplication table. The same is true of the addition table. So arithmetic would be that much easier for everybody. In his book "The Realm of Numbers" Isaac Asimov spends some time extolling the virtues of Base 12: Observe how useful the dozen is. If you have a dozen apples, you can divide them equally into 2 groups of 6 each, 3 groups of 4 each, 4 groups of 3 each, 6 groups of 2 each, or 12 groups of 1 each. The important thing is that not only are 2 and 4 [as in number systems based on 16] factors of 12, but 3 is also. . . . The convenience of such factoring in practical arithmetic is great, and there are people who wish that we had used 12 as the base of our number system instead of 10.

The number 10 has only two factors, 2 and 5, and cannot be divided evenly by either 3 or 4. The only reason 10 won out over 12 is probably the anatomical accident that we have 5 fingers on each hand. Now if we had had 6 on each hand -- I say the importance of a factor of 3 is grossly trumped up; that it is not something we have a natural feel for, and division by 4, which is very natural in Base 8, gives something very similar anyhow. If a factor of 3 is so important, why not 5 and 7, etc? Moreover, Base 12 all of a sudden gives us multiplication and addition tables 44% larger than in Base 10 - yeowww! I say, now if we had only ignored our thumbs -- As admitted at the beginning, we're not likely to convert over tomorrow with a big smile on our face. And it certainly wouldn't be worth the effort if we're going to wipe ourselves out or revert to cavemen in the next few decades. It's hard to envision any given generation saying, "Sure, we'll take a dive for future generations.

It's for all the kids, man." I'm guessing it'll be more than just the grannies wondering what happened to all the numbers between 77 and 100. But to pull this out of the depths of complete impossibility, I offer a plan. The plan is simply a new set of numerals for Base 8. In that way, Base 10 and Base 8 could coexist until the time comes when Base 10 has faded silently away forever (or until 3-fingered aliens descend upon us.) After all, we seem to survive with lots of different units of measure going on. Do we ever. (See my proposal for fixing the units mess.) What occurred to me was to flip our current numerals left-for-right.

It works out nice that 2 through 7 are not symmetric about a vertical axis, and 8, which is symmetric, is not used in Base 8 (which will be called Base 10, heehee.) 0 and 1, in their basic forms are symmetric, but they need new characters, anyhow, as they do in Base 10, to finally eliminate the mess caused by the identity with alphabetic characters - ohs and zeros and ells and ones and eyes, oh my. To refresh your memory, here are the numerals from 0 to 7 (in reverse order - why did I do that, I wonder?): Here they are flipped left-for-right. (I didn't say mirror image. Mirrors don't flip left and right, but we won't get into that here. Ok, we will, since I brought it up. It's us that flip left and right when we turn something toward a mirror.

A mirrors pulls the object through itself, back to front, which has the effect of making a right-handed object look left-handed.) And tweaking them a bit for the sake of writeability and uniqueness, this is what I ended up with for our Base 8 numerals: Just an idea; this doesn't have to be the final word. I suppose now you want me to tell you how to say the Base 8 numbers, huh? To be honest, I hadn't given it any thought for all these years until I got to this point in this web page. But oot answers come right to mind, the nuwhth being ever so slightly tongue in cheek - we can pronounce the numbers backwards, too. That's not hard: oh-reez', nuwh, oot, eethr, orf, vee-ahf', skiss, and nev-ess'. How's that for English chauvinism? The ootth answer is to leave this to the people putting together our universal second language (see my page on that) , since Base 8 will be the official number system in that language, right?

Then the problem is solved once and for all for everybody, as opposed to new and different words being added to each of the thousands of languages out there. If the panel wants a bit of advice, I would suggest that there be only pronunciations for numbers, no associated written words. In the universal second language numbers will only be written as numerals. Numerals will be considered elemental, as letters are for words, and representing numerals with letter combinations will be viewed as nonsensical.

So you can hit the ground running when Base 8 comes along, here is the addition table: Base 8 Addition Table 0 1 2 3 4 5 6 7 10 1 2 3 4 5 6 7 10 11 2 3 4 5 6 7 10 11 12 3 4 5 6 7 10 11 12 13 4 5 6 7 10 11 12 13 14 5 6 7 10 11 12 13 14 15 6 7 10 11 12 13 14 15 16 7 10 11 12 13 14 15 16 17 10 11 12 13 14 15 16 17 20 Got it? 7 + 5 = 14. Now here's the multiplication table.

WARNING: Figuring that everybody would give this one glance and surf off into the wild blue yonder, I planted an error or so to snag a few visitors into taking a closer look. Base 8 Multiplication Table 1 2 3 4 5 6 7 10 2 4 6 8 12 14 16 20 3 6 11 14 17 22 25 30 4 10 14 20 24 30 34 40 5 12 17 24 31 36 43 50 6 14 22 30 36 44 52 60 7 16 25 34 43 52 63 70 10 20 30 40 50 60 70 100 5 x 5 = 31 . . . what a gas!

Notice it's multiplication by 4 that gives the nice sequence of answers alternately ending in 0 and 4. *** DON'T GET LEFT BEHIND! You can get started in Base 8 by leaving out all the 8's and 9's while trying to fall to sleep tonight: 1 sheep . . . 2 sheep . . . 3 sheep . . . 4 sheep . . . 5 sheep . . . 6 sheep . . . 7 sheep . . . 10 sheep . . . 11 sheep . . . 12 sheep . . . 13 sheep . . . 14 sheep . . . 15 sheep . . . 16 sheep . . . 17 sheep . . . 20 sheep . . . 21 sheep . . . 22 sheep . . . 23 sheep . . . 24 sheep . . . 25 sheep . . . 26 sheep . . . 27 sheep . . . 30 sheep . . . 31 sheep . . . 32 sheep . . . 33 sheep . . . 34 sheep . . . 35 sheep . . . 36 sheep . . . 37 sheep . . . 40 sheep . . . 41 sheep . . .

42 sheep . . . 43 sheep . . . 44 sheep . . . 45 sheep . . . 46 sheep . . . 47 sheep . . . 50 sheep . . . 51 sheep . . . 52 sheep . . . 53 sheep . . . 54 sheep . . . 55 sheep . . . 56 sheep . . . 57 sjeep . . . 60 sheep . . . 61 sheep . . . 62 sheep . . . 63 skeep . . . 64 sheep . . . 65 sheep . . . 66 sheep . . . 67 sseep . . . 70 sheep . . . 71 sweep . . . 72 sneep . . . 73 sheep . . . 74 smeep . . . 75 sheep . . . 76 sheep . . . 77 sbeep . . . 100 sheep . . . 101 szeep . . . szzzzzzz . . . Base 8: Math Copyright (c) 1998 by Kenny Felder This paper is about a whole new way to count.

Now, you may be wondering why anyone would bother with a whole new way to count, when the old way seems to work perfectly well. But I'm going to ask you to hold on to that question for the moment, and instead ask yourself something different: what's so special about the number ten? You may never have asked yourself that. In our system of counting, everything changes after the number 9. You suddenly have to start all over and add another digit, and write "one-oh" (10). Sure, we call it "ten," but we write it "one-oh." Why do we do that? Think about that for a minute, and try to figure out the reason. Trick question! There isn't any great reason. It's probably because we have ten fingers. So our ancestors had to start over when they ran out of fingers, and then again start over when they ran out of toes, and so we all got into the habit of starting over every tenth thing we counted. It didn't have to be that way. You can just as easily base a counting system on the number eight, or the number twelve, or just about any number you want.

And in factgetting back to my original question, of why anyone would botherwe do use alternative counting systems in some cases, such as in computers. So here's what I'm going to do in this paper. First, I'm going to describe our normal ("base ten") counting system. You won't learn anything terribly new, but please don't skip that section, because it will present the ideas in a way that you may not have thought about them before. Then I'm going to go on to explain "base eight" counting. If you follow both sections, you will hopefully realize that they are both built on exactly the same principles, so once you can do one, you can do the other. Then at the end we'll test that knowlege, by asking you to do base sixteen! Ready? Here we go, starting with... Base Ten, Also Known as "Decimal" Counting Our normal counting system is called "base ten" because we have exactly ten symbols to work with: 0 1 2 3 4 5 6 7 8 9 Out of those ten symbols, we have to be able to represent every possible number from 1 all the way up as high as we can go.

How do we do that? Well, we start by listing all the symbols after the "zero." 1 8 9 When we get to that point, we're out of symbols. So what do we do? We go all the way down to zero, and add a one to our left: we write "one-zero" (10). This strange two-number pair means "the number after nine," or what we generally call "ten." Now we start counting on the right again: one-one, one-two, one-three, and so on. (11, 12, 13...) Soon we hit one-nine (19) and we run out of digits again, so we have to increment on the left: two-zero, or 20. You see what I mean? Every tenth number, we start over again. This system works great until we get to 99, and then we can't increment the left-hand digit any more. So we move to the left again and write one-zero-zero (100)...and so on. This is all very familiar, I expect. But it's good to review it and get it clear in your mind.

When I write the decimal number 1235 in this system, what do I mean? I mean 5 "ones", 3 "tens", 2 "hundreds", and 1 "thousand." Each step to the left involves a multiplication by tenbecause we are in base ten. So if there were another digit to the left, we know it would count as "ten thousands" since that is ten times "thousands," and so on. Please stop at this point and make sure everything I've just said makes perfect sense to you. It isn't enough to be able to count: you have to understand the theory in the way I've described it. If it all makes sense, the restbelieve it or notshould be pretty easy. Introducing Base Eight So what if we had eight fingers, or for some other reason, we decided to start over every eighth number instead of every tenth? Then we would have "base eight" (also known as "octal") counting.

In this system, there are eight symbols to work with: 0 1 2 3 4 5 6 7 We don't need an 8 or a 9 at all: out of just those eight symbols above, we are going to represent every possible number! So, we start by listing all the symbols after the "zero." 1 6 7 When we get to that point, we're out of symbols. So what do we do? We go all the way down to zero, and add a one to our left: we write "one-zero" (10). It means "the number that comes after seven," or what we normally call "eight." This is the key turning point in this paper, so make sure you're still with me: when I write "one-oh" (10) in base eight, I don't mean ten, I mean the number eight. The numbers in base eight look just like our normal numbers (except that they never use the symbols 8 or 9), but they don't mean the same things. You have to think in "eights" to understand them, just as you have to think in "tens" to understand our normal system.

Now we start counting on the right again: one-one, one-two, one-three, and so on. (11, 12, 13...) Soon we hit one-seven (17) and we run out of digits again, so we have to increment on the left: two-zero, or 20. Every eighth number, we start over again. This system works great until we get to 77, and then we can't increment the left-hand digit any more. So we move to the left again and write one-zero-zero (100). It's important to remember again that this doesn't mean the same thing we normally call "one hundred" so it's best not to call it that: call it "one-zero-zero" and it will help keep things straight. So, when I write the octal number 1235 what do I mean? I mean 5 "ones", 3 "eights", 2 "sixty-fours", and 1 "five-hundred-and-twelve." Each step to the left involves a multiplication by eightbecause we are in base eight.

So if there were another digit to the left, we know it would count as "four-thousand-and-ninety-sixes" since that is eight times "five-hundred-and-twelves," and so on. If you've followed everything I've done so far, you have hopefully understood a few things. First, you understand that our normal system of counting is based on the principle that every tenth number, you start over and move to the leftbecause there are only ten symbols to work with. Second, you understand that there's nothing sacred about the number ten: base eight is exactly the same, except it happens to start over every eighth number, because it has eight symbols to work with. Once you can do base ten counting, there's nothing fundamentally different about base eight. But you may still be wondering, what does 1235 base eight really mean?

Well, I said above that it is 5 "ones", 3 "eights", 2 "sixty-fours", and 1 "five-hundred-and-twelve." If you add all that up, 5*1 + 3*8 + 2*64 + 1*512 = 669 So we can say "1235 base eight equals 669 base ten." Or, to put it another way, "when you write 1235 in base eight, you really mean the number six-hundred and sixty-nine." That's a kind of base-ten-centric way to put it, but hey, we're base-ten-centric people. And in any case, the point I'm making is that it's easy to convert base eight numbers into their base ten equivalents, once you understand the system. Your Turn What I've just done is give a lecture on "how to count" in base ten, and then repeat the exact same lecture for base eight.

Base sixteen, or "hexadecimal" notation, works exactly the same way, except that it starts with sixteen symbols: 0 1 2 3 4 5 6 7 8 9 A B C D E F Just as base ten uses a few symbols that base eight doesn't need ("8" and "9"), base sixteen uses a few symbols that base ten doesn't need. These symbols are the first six alphabetic characters. So A represents the number we usually call "ten"; the highest single digit is F which represents our "fifteen." After that you have to start over. What I would like to ask you to do, at this point, is to duplicate the exact "lecture" I gave above on base eight, except you do it in base sixteen. Start where I wrote "we start by listing" and go all the way to "1235 base eight = 669 base ten," but write everything in terms of base sixteen. Of course, the final answer (1235 base sixteen equals what in base ten?) will be different: work the problem yourself, then click here to check your answer.

More to think about So you got this far, and you're hungry for more? Here are some great things to think about. Repeat the same lecture again for base two ("binary"), which is how computers count. In this system, there are only two digits, 0 and 1. How do you add numbers in base eight? Of course, you do it the same as base ten, but you have to be careful: for instance, "6+4=12" in base eight! Make up and try some problems, and check your answers by converting everything to base ten. How do you convert a base ten number to base eight? This is trickier than going the other way! When I say "seven years and four months" I'm basically counting months in base twelve, since I start over every twelfth month. Can you think of a similar real-life example where we use base twenty-four? Base sixteen? How about base three-hundred-and-sixty-five? Something to think about: is it possible to count in "base one"? Finally, for a much more fun look at this whole topic, check out the Schoolhouse Rock song Little Twelvetoes .

Gary and Kenny Felder's Math and Physics Help Home Page Number Bases: Introduction & Binary Numbers | Purplemath Number Bases: Introduction & Binary Numbers Intro & Binary Base-4 & Base-7 Octal & Hex Purplemath 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). Content Continues Below MathHelp.com 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". (The Romans did , in their character "X".) 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. Affiliate 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". Binary Advertisement Let'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 and 0 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: ← swipe to view full table → decimal Then 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: The above graphic is animated on the "live" web page. 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 with the final value and its remainder, and wrapping my way around and down the right-hand side of the sequential division.

Then: 35710 converts to 1011001012. WyzAnt Tutoring Affiliate 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. If you're interested, an explanation of why this method works is available here . 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 look at a few more examples ... URL: Number Systems Number Systems Following are some of the different number systems discussed in the history of mathematics. Contents of this Page The Number Sense The number sense is not the ability to count, but the ability to recognize that something has changes in a small collection. Some animal species are capable of this. The number of young that the mother animal has, if changed, will be noticed by all mammals and most birds. Mammals have more developed brains and raise fewer young than other species, but take better care of their young for a much longer period of time. Many birds have a good number sense.

If a nest contains four eggs, one can safely be taken, but when two are removed the bird generally deserts. The bird can distinguish two from three.1 An experiment done with a goldfinch showed the ability to distinguish piles of seed: three from one, three from two, four from two, four from three, and six from three. The goldfinch almost always confused five and four, seven and five, eight and six, and ten and six. Another experiment involved a squire who was trying to shoot a crow which made its nest in the watchtower of his estate. The squire tried to surprise the crow, but at his approach, the crow would leave, watch from a distance, and not come back until the man left the tower. The squire then took another man with him to the tower. One man left and the other stayed to get the crow when it returned to the nest, but the crow was not deceived. The crow stayed away until the other man came out. The experiment was repeated the next day with three men, but the crow would not return to the nest.

The following day, four men tried, but it was not until that next day with five men that the crow returned to the nest with one man still in the tower.2 In the insect world, the solitary wasp seemed to have the best number sense. �The mother wasp lays her eggs in individual cells and provides each egg with a number of live caterpillars on which the young feed when hatched. Some species of wasp always provide five, others twelve, and others as high as twenty-four caterpillars per cell. The solitary wasp in the genus Eumenus, will put five caterpillars in the cell if it is going to be a male (the male is smaller) and ten caterpillars in a female�s cell. This ability seems to be instinctive and not learned since the wasp�s behavior is connected with a basic life function.�3 One might think people would have a very good number sense, but as it turns out, people do not. �Experiments have shown that the average person has a number sense that is around four.�4 People groups in the world today that have not developed finger counting have a hard time discerning the quantity four.

They tend to use the quantities one, two and many-which would include four. �Small children around fourteen months of age will almost always notice something that is missing from a group that he or she is familiar with. The same age child can usually reassemble objects that have been separated into one group again. But the child�s ability to perceive numerical differences in the people or objects around him or her are very limited when the number goes beyond three or four.�5 So what separates people from the rest of the animal kingdom? It may include many things, but the ability to count is very much one of them. Counting, which usually begins at the end of our own hands or fingers, is usually taught by another person or possibly by circumstance. It is something that we should never take lightly for it has helped advance the human race in countless ways. The number sense is something many creatures in this world have as well as well as we do. Although, as we can see, our human ability is not much better than the common crow�s ability. We are born with the number sense, but we get to learn how to count. 1 Dantzig, p. 1. Numbering Systems Numbering Systems as a Microsoft Word 97-98 file.

Learning Objectives To understand the principles of numbering systems To convert numbers from one base to another To be able to do arithmetic in binary and hexadecimal This supplement to Long and Long learning resources (published by Prentice Hall) on computer competency presents the principles of numbering systems, discusses numbering-system arithmetic, and illustrates how to convert a value in one numbering system to its equivalent in another. After studying this supplement you will be able to perform rudimentary arithmetic operations in the binary and hexadecimal numbering systems. CONTENTS NUMBERING SYSTEMS AND COMPUTERS We humans use a decimal, or base-10, numbering system, presumably because people have 10 fingers. If we had three fingers and a thumb on each hand, as does the Extra Terrestrial (E.T.), from the classic movie, and Homer Simpson of the Simpsons, then in all probability we would be using the octal numbering system, which has a base of 8. Early computers were designed around the decimal numbering system. This approach made the creation of computer logic capabilities unnecessarily complex and did not make efficient use of resources.

(For example, 10 vacuum tubes were needed to represent one decimal digit.) In 1945, as computer pioneers were struggling to improve this cumbersome approach, John von Neumann suggested that the numbering system used by computers should take advantage of the physical characteristics of electronic circuitry. To deal with the basic electronic states of on and off, von Neumann suggested using the binary numbering system. His insight has vastly simplified the way computers handle data. Computers operate in binary and communicate to us in decimal. A special program translates decimal into binary on input, and binary into decimal on output. Under normal circumstances, a programmer would see only decimal input and output. On occasion, though, he or she must deal with long and confusing strings of 1s and 0s that represent the content of RAM, the computers memory. Occasionally a programmer or computer engineer takes a snapshot of the contents of RAM (on-bits and off-bits) at a given moment in time. To reduce at least part of the confusion of seeing only 1s and 0s on the output, the hexadecimal (base-16) numbering system is used as a shorthand to display the binary contents of both RAM and secondary storage, such as disk.

The decimal equivalents for binary, decimal, and hexadecimal numbers are shown in Figure 1. We know that in decimal, any number greater than 9 is represented by a sequence of digits. When you count in decimal, you "carry" to the next position in groups of 10. As you examine Figure 1, notice that you carry in groups of 2 in binary and in groups of 16 in hexadecimal. Also note that any combination of four binary digits can be represented by one "hex" digit. FIGURE 1 Numbering System Equivalence Table The hexadecimal numbering system is used only for the convenience of the programmer or computer scientist, or computer engineer when reading and reviewing the binary display of memory. Computers do not operate or process in hex. During the 1960s and early 1970s, programmers often had to examine the contents of RAM to debug their programs (that is, to eliminate program errors). Today's programming languages have user friendly diagnostics (error messages) and computer-assisted tools that help programmers during program development. These diagnostics and development aids have minimized the need for applications programmers to convert binary and hexadecimal numbers into their more familiar decimal equivalents.

However, if you become familiar with these numbering systems, you should achieve a better overall understanding of computers. And, someday you may need to read hex to decode an error message or set the jumpers on an expansion card. PRINCIPLES OF NUMBERING SYSTEMS Binary The binary, or base-2, numbering system is based on the same principles as the decimal, or base-10, numbering system, with which we are already familiar. The only difference between the two numbering systems is that binary uses only two digits, 0 and 1, and the decimal numbering system uses 10 digits, 0 through 9. The equivalents for binary, decimal, and hexadecimal numbers are shown in Figure 1. The value of a given digit is determined by its relative position in a sequence of digits. Consider the example in Figure 2. If we want to write the number 124 in decimal, the interpretation is almost automatic because of our familiarity with the decimal numbering system. To illustrate the underlying concepts, let's give Ralph, a little green two-fingered Martian, a bag of 124 (decimal) marbles and ask him to express the number of marbles in decimal.

Ralph, who is more familiar with binary, would go through the following thought process (see Figure 2). FIGURE 2 Numbering System Fundamentals Ralph, our two-fingered Martian who is used to counting in binary, might go through the thought process illustrated here when counting 124 marbles in decimal. Ralph's steps are discussed in the text. Step 1. Ralph knows that the relative position of a digit within a string of digits determines its value, whether the numbering system is binary or decimal. Therefore, the first thing to do is determine the value represented by each digit position. Step 2. Ralph knows that as in any numbering system, the rightmost position has a value of the base to the zero power, or 1 (100 = 1). The second position is the base to the first power, or 10 (101 = 10). The third position is the base squared, or 100, and so on. Step 3. Because the largest of the decimal system's 10 digits is 9, the greatest number that can be represented in the rightmost position is 9 (9 X 1).

The greatest number that can be represented in the second position, then, is 90 (9 X 10). In the third position, the greatest number is 900, and so on. Having placed the marbles in stacks of 10, Ralph knows immediately that there will be no need for a fourth-position digit (the thousands position). It is apparent, however, that a digit must be placed in the third position. Because placing a 2 in the third position would be too much (200 > 124), Ralph places a 1 in the third position to represent 100 marbles. Step 4. Ralph must continue to the second position to represent the remaining 24 marbles. In each successive position, Ralph wants to represent as many marbles as possible. In this case, a 2 placed in the second position would represent 20 of the remaining marbles (2 X 101 = 20). Step 5. There are still four marbles left to be represented. This can be done by inserting a 4 in the rightmost, or "ones," position. Step 6.

The combination of the three numbers in their relative positions represents 124 (decimal). Ralph would go through the same thought process if asked to represent the 124 (decimal) marbles using the binary numbering system (see Figure 3). To make the binary conversion process easier to follow, the computations in Figure 3 are done in the more familiar decimal numbering system. See if you can trace Ralph's steps as you work through Figure 3. FIGURE 3 Representing a Binary Number To represent 124 marbles in binary, we would follow the same thought process as we would in decimal (see Figure 2), but this time we have only two digits (0 and 1). For ease of understanding, the arithmetic is done in decimal. Hexadecimal Perhaps the biggest drawback to using the binary numbering system for computer operations is that programmers may have to deal with long and confusing strings of 1s and 0s. To reduce the confusion, the hexadecimal, or base-16, numbering system is used as shorthand to display the binary contents of primary and secondary storage. Notice that the bases of the binary and hexadecimal numbering systems are multiples of 2: 2 and 24, respectively.

Because of this, there is a convenient relationship between these numbering systems. The numbering-system equivalence table shown in Figure 1 illustrates that a single hexadecimal digit represents four binary digits (01112 = 716, 11012 = D16, 10102 = A16 where subscripts are used to indicate the base of the numbering system). Notice that in hexadecimal, or "hex," letters are used to represent the six higher order digits. Two hexadecimal digits can be used to represent the eight-bit byte of an EBCDIC equals sign (=) (011111102 is the same as 7E16). Figure 4 illustrates how a string of EBCDIC bits can be reduced to a more recognizable form using hexadecimal. FIGURE 4 System Expressed in Different Ways The word System is shown as it would appear in input/output, internal binary notation, and hexadecimal notation. We will now examine how to convert one number in a numbering system to an equivalent number in another numbering system. For example, there are occasions when we might wish to convert a hexadecimal number into its binary equivalent. We shall also learn the fundamentals of numbering-system arithmetic.

CONVERTING NUMBERS FROM ONE BASE INTO ANOTHER Decimal to Binary or Hexadecimal A decimal number can be converted easily into an equivalent number of any base by the use of the division/remainder technique. This two-step technique is illustrated in Figure 5. Follow these steps to convert decimal to binary. FIGURE 5 Converting a Decimal Number into Its Binary Equivalent Use the twoBstep division/remainder technique to convert a decimal number into an equivalent number of any base. Step 1. Divide the number (19, in this example) repeatedly by 2, and record the remainder of each division. In the first division, 2 goes into 19 nine times with a remainder of 1. The remainder is always one of the binary digits--0 or 1. In the last division you divide 1 by the base (2) and the remainder is 1. Step 2. Rotate the remainders as shown in Figure 5; the result (10011) is the binary equivalent of a decimal 19. Figure 6 illustrates how the same division/remainder technique is used to convert a decimal 453 into its hexadecimal equivalent (1C5).

In a decimal-to-hex conversion, the remainder is always one of the 16 hex digits. FIGURE 6 Converting a Decimal Number into Its Hexadecimal Equivalent The two-step division/remainder technique is used to convert a decimal number to its hex equivalent. Binary to Decimal and Hexadecimal To convert from binary to decimal, multiply the 1s in a binary number by their position values, then sum the products (see Figure 7). In Figure 7, for example, binary 11010 is converted into its decimal equivalent (26). FIGURE 7 Converting a Binary Number into Its Decimal Equivalent Multiply the 1s in a binary number by their position values. The easiest conversion is binary to hex. To convert binary to hex, simply begin with the 1s position on the right and segment the binary number into groups of four digits each (see Figure 8). Refer to the equivalence table in Figure 2, and assign each group of four binary digits a hex equivalent. Combine your result, and the conversion is complete. Hexadecimal to Binary To convert hex numbers into binary, perform the grouping procedure for converting binary to hex in reverse (see Figure 8).

FIGURE 8 Converting a Binary Number into Its Hexadecimal Equivalent Place the binary digits in groups of four, then convert the binary number directly to hexadecimal. Hexadecimal to Decimal Use the same procedure as that used for binary-to-decimal conversions (see Figure 7) to convert hex to decimal. Figure 9 demonstrates the conversion of a hex 3E7 into its decimal equivalent of 999. FIGURE 9 Converting a Hexadecimal Number into Its Decimal Equivalent Multiply the digits in a hexadecimal number by their position values. ARITHMETIC IN BINARY AND HEXADECIMAL The essentials of decimal arithmetic operations have been drilled into us so that we do addition and subtraction almost by instinct. We do binary arithmetic, as well as that of other numbering systems, in the same way that we do decimal arithmetic. The only difference is that we have fewer (binary) or more (hexadecimal) digits to use. Figure 10 illustrates and compares addition and subtraction in decimal with that in binary and hex. Notice in Figure 10 that you carry to and borrow from adjacent positions, just as you do in decimal arithmetic.

FIGURE 10 Binary, Decimal, and Hexadecimal Arithmetic Comparison As you can see, the only difference in doing arithmetic in the various numbering systems is the number of digits used. Bit,s, Bytes and Number Systems- Decimal, Binary, Hexadecimal, Octal. ASCII Codes. Reference for programmers Binary System Introduction This tutorial is going to assist you with the different numbering systems that are used in programming. Programmers will need to be familiar with most of them. You are already familiar with our every day denary numbering system based on the unit 10. Computers only understand the binary number system based on the unit 2 denary. Programming often uses the hexadecimal system base on a unit of 16 denary. For example HTML uses hexadecimal numbering in the color attribute, e.g. color="FF00FF". Another less common system is octal based on 8 denary. You should know how to convert between the different systems. The ASCII table at the foot of this page is useful for a quick conversions up to 127 denary. The windows calculator (in scientific mode) can be used for conversions.

College and University students may find that calculators are not allowed in the exam, OU course T223 is an example of this, therefore manual conversion calculations must be made. This should be practiced to speed up the process, the calculator only used to check your manual conversion. Bit A binary digit is called a bit. Usually expressed as 0 and 1 the two numbers of the binary numbering system. A bit is the smallest unit of information a computer can use. A 16 bit computer would process a series of 16 bits,such as 0100111101011000 in one go, repeating the process thousands or millions of times per second. Reading a series of bits is very difficult and to make this process easier they are often displayed in groups of 4 bits 0100 1111 0101 1000 This grouping is quite interesting in that a group of 4 bits can be replaced by a single hexadecimal digit Two groups of 4 bits, i.e. 8 bits ( a byte) can be replaced by 2 hexadecimal digits, and 4 hexadecimal digits are required to replace all 16 bits.

Binary Hexadecimal numbers Hexadecimal Number System The hexadecimal (base 16) number system operates the same way as the decimal (base 10) number system, except it is based on sixteen instead of ten. The operation of the decimal system is familiar. The 4-digit base-10 number 5826 appears below, indicating how the value of the number is derived from the values of its 4 digits. Everybody knows that 5826 means five-thousand eight-hundred twenty-six. But only because they have been taught that 1, 10, 100, and 1000 are part of the calculation even though they are never written. All that is actually written is a total of twenty-one (5 and 8 and 2 and 6). Only the interpretation that people supply, which is purely mental and unwritten, informs what is written with its intended value. Hexadecimal operates the same way. Each digit is "weighted" by a "multiplier," with the results all added together. The multipliers in both systems are the powers of the system base (10 or 16).

The powers of 10 are 1, 10, 100, 1000, etc. while those of 16 are 1, 16, 256, 4096, etc. So the same digits "5826" used in base 16 represent a value calculated as follows: Though the digits are the same (5826) the values come out quite different, because the base and its "multiplier values" are different. You will see hexadecimal numbers some of whose digits are letters instead of numbers. That's because the number of digits needed by any number system is the number's base. So base base 2 needs 2 digits, base 10 needs 10, and base 16 needs 16. Base 2 has 0 and 1. Base 10 has 0 through 9. Base 16 borrows 0 though 9 but needs another 6. For those, we could invent some symbols. However, for convenience we employ the first 6 letters of the alphabet (A through F) instead.

When we run out of digits at 9, we use A as the next digit. So A represents the value 10. B comes next, and represents 11. The hexadecimal digits and thevalue they stand for are: Hexadecimal digit 15 Here's the derivation of the value of another 4-digit hexadecimal number, but this one uses some of the high-order digits A-F: The highest you can count with a given number of digits (in any number system) is the number in which every digit contains the maximum value in the number system (1 in base 2, or 9 in base 10, or F in base 16). So the largest number you can represent with 4 digits in base 16 is: Counting any higher than that would require that you utilize more digits. The very next number is 10000 in hexadecimal, or 65536 in decimal. It is a well-known value in computer science and is called "64K." Number Systems: An Introduction to Binary, Hexadecimal, and More Number Systems: An Introduction to Binary, Hexadecimal, and More Advertisement Ever see crazy binary numbers and wonder what they meant?

Ever see numbers with letters mixed in and wonder what is going on? You'll find out all of this and more in this article. Hexadecimal doesn't have to be scary. (Thanks to the ReBoot Wiki for the thumbnail image.) Introduction: What is a Number System? You probably already know what a number system is - ever hear of binary numbers or hexadecimal numbers? Simply put, a number system is a way to represent numbers. We are used to using the base-10 number system, which is also called decimal. Other common number systems include base-16 (hexadecimal), base-8 (octal), and base-2 (binary). In this article, I'll explain what these different systems are, how to work with them, and why knowing about them will help you. Activity Before we get started, let's try a little activity for fun. There are many different ways to represent a color, but one of the most common is the RGB color model. Using this model, every color is made up of a combination of different amounts of red, green, and blue. You may be wondering how colors relate to number systems.

In short, on a computer, any color is stored as a large number: a combination of red, green, and blue. (We'll go into more detail on this later.) Because it's just a number, it can be represented in multiple ways using different number systems. Your job is to guess how much red, green, and blue is in the background color of the activity below. The values for red, green, and blue can range from 0 to 255. Feel free to use the various hints provided to help you out. If you don't understand the numerical hints yet, no problem! You can see what your guess looks like using the View Guess button. Right now, it may seem tricky, but hopefully by the end of the article, it will seem easy. Looking at Base-10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11... You've counted in base-10 all of your life. Quick, what is 7+5? If you answered 12, you are thinking in base-10.

Let's take a closer look at what you've been doing all these years without ever thinking about it. Let's take a quick look at counting. First, you go through all the digits: 0, 1, 2... Once you hit 9, you have no more digits to represent the next number. So, you change it back to 0, and add 1 to the tens digit, giving you 10. The process repeats over and over, and eventually you get to 99, where you can't make any larger numbers with two digits, so you add another, giving you 100. Although that's all very basic, you shouldn't overlook what is going on. The right-most digit represents the number of ones, the next digit represents the number of tens, the next the number of hundreds, etc. Visualizing Base-10 Confused by these descriptions? No problem - below is a demo to help you out. Simply enter a number in the text box and click draw. Try entering a large number, like 2347. You'll see 2 groups of one thousand, 3 groups of one hundred, 4 groups of ten, and 7 individual blocks.

Base-10 Mathematically You may have noticed a pattern by now. Let's look at what is going on mathematically, using 2347 as an example. As you saw, there are 2 groups of a thousand. Not coincidentally, 1000 = 10*10*10 which can also be written as 103. There are 3 groups of a hundred. Again, not coincidentally, 100 = 10*10 or 102. There are 4 groups of ten, and, 10 = 101. Finally, there are 7 groups of one, and 1 = 100. (That may seem strange, but any number to the power of 0 equals 1, by definition.) This is essentially the definition of base-10. To get a value of a number in base-10, we simply follow that pattern.

Here are a few more examples: 892 = 8*102+9*101+2*100 1147 = 1*103+1*102+4*101+7*100 53 = 5*101+3*100 Admittedly, this all seems a little silly. We all know what value a base-10 number is because we always use base-10, and it comes naturally to us. As we'll see soon, though, if we understand the patterns in the background of base-10, we can understand other bases better. Base-8 On to base-8, also called octal. Base-8 means just what is sounds like: the system is based on the number eight (as opposed to ten). Remember how in base-10 we had ten digits? Now, in base-8, we are limited to only eight digits: 0, 1, 2, 3, 4, 5, 6, and 7. There's no such thing as 8 or 9.

We count the same way as we normally would, except with only eight digits. Instead of a lengthy explanation, simply try out the demo below by clicking "Count Up 1" to see how counting in base-8 works. You should notice a similar pattern to before; after we get to 7, we run out of different digits for any higher number. We need a way to represent eight of something. So we add another digit, change the 7 back to 0, and end up with 10. Our answer of 10 in base-8 now represents what we would normally think of as 8 in base-10. Talking about numbers written in multiple bases can be confusing. For example, as we have just seen, 10 in base-8 is not the same as 10 in base-10. So, from this point on, I'll use a standard notation where a subscript denotes the base of numbers if needed. For example, our base-8 version of 10 now looks like 108. (Editor's note: I find it a lot easier to understand this if I change the way I read these numbers in my head, too.

For example, for 108, I read "octal one-oh" or "one-oh in base-eight". For 1010 I read "decimal one-oh" or "one-oh in base-ten".) Great, so we know 108 represents eight items. (Always feel free to plug a number into the first tool for a visualization.) What's the next number after 778? If you said 1008, you're correct. We know from what we've learned so far that the first 7 in 778 represents groups of 8, and the second 7 represents induvidual items. If we add these all up, we have 7*8 + 7*1 = 63. So we have a total of 6310. So 778=6310. We all know 6410 comes after 6310. Converting From Base-8 to Base-10 Let's look at a wordier example now. John offers to give you 478 cookies, and Jane offers to give you 4310 cookies. Whose offer do you take?

If you want, go ahead and generate the graphic for 478 graphic with the first tool. Let's figure out its base-10 value so we can make the best decision! As we saw when counting, the four in 478 represents the number of groups of eight. This makes sense - we are in base-8. So, in total, we have four groups of eight and seven groups of one. If we add these all up, we get 4*8 + 7*1 = 3910. So, 478 cookies is the exact same as 3910 cookies. Jane's offer seems like the best one now! The pattern we saw before with base-10 holds true here also. We'll look at 5238. There are five groups of 82, two groups of 81 and three groups of 80 (remember, 80=1). If we add these all up, 5*82 + 2*81 + 3*80 = 5*64+2*8+3 = 339, we get 33910 which is our final answer.

The diagram below shows the same thing visually: Here are a couple more examples: 1118 = 1*82+1*81+1*80 = 64+8+1 = 7310 438 = 4*81+3*80 = 32+3 = 3510 61238 = 6*83+1*82+2*81+3*80 = 3072+64+16+3 = 315510 Converting from Base-10 to Base-8 Converting from base-10 to base-8 is a little trickier, but still straightforward. We basically have to reverse the process from above. Let's start with an example: 15010. We first find the largest power of 8 that is smaller than our number. Here, this is 82 or 64 (83 is 512). We count how many groups of 64 we can take from 150. This is 2, so the first digit in our base-8 number is 2.

We have now accounted for 128 out of 150, so we have 22 left over. The largest power of 8 that is smaller than 22 is 81 (that is, 8). How many groups of 8 can we take from 22? Two groups again, and thus our second digit is 2. Finally, we are left with 6, and can obviously take 6 groups of one from this, our final digit. We end up with 2268. In fact, we can make this process a touch clearer with math. Here are the steps: 150/82 = 2 remainder 22 22/81 = 2 remainder 6 6/80 = 6 Our final answer is then all of our non-remainder digits, or 226. Notice that we still start by dividing by the highest power of 8 that is less that our number. Dealing with any Base It's important to be able to apply the concepts we've learned about base-8 and base-10 to any base.

Just as base-8 had eight digits and base-10 had ten digits, any base has the same number of digits as its base. So base-5 has five digits (0-4), base-7 has seven digits (0-6), etc. Now let's see how to find the base-10 value of any number in any base. Say we are working in base-b, where b can be any positive integer. We have a number d4d3d2d1d0 where each d is a digit in a number. (The subscripts here don't refer to the base of the number but simply differentiate each digit.) Our base-10 value is simply d4*b4 + d3*b3 + d2*b2 + d1*b1 + d0*b0. Here's an example: we have the number 32311 in base-4. Notice how our number only has digits from zero to three since base-4 only has four total digits.

Our base-10 value is 3*44 + 2*43 + 3*42 + 1*41 + 1*40 = 3*256 + 2*64 + 3*16 + 1*4 + 1*1 = 949. We could, or course, follow this pattern with any amount of digits in our number. Base-16 Base-16 is also called hexadecimal. It's commonly used in computer programming, so it's very important to understand. Let's start with counting in hexadecimal to make sure we can apply what we've learned about other bases so far. Since we are working with base-16, we have 16 digits. So, we have 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... and yikes! We've run out of digits, but we still need six more. Perhaps we could use something like a circled 10? The truth is, we could, but this would be a pain to type.

Instead, we simply use letters of the alphabet, starting with A and continuing to F. Here's a table with all the digits of base-16: Other than these extra digits, hexadecimal is just like any other base. For example, let's convert 3D16 to base-10. Following our previous rules, we have: 3D16 = 3*161 + 13*160 = 48 + 13 = 61. So 3D16 is equal to 6110. Notice how we use D's value of 13 in our calculation. We can convert from base-10 to base-16 similar to the way we did with base-8. Let's convert 69610 to base-16. First, we find the largest power of 16 that is less than 69610. This is 162, or 296.

Then: 696/162 = 2 remainder 184 8/161 = 8 remainder 0 We have to replace 11 with its digit representation B, and we get 2B816. Feel free to try some more conversions for practice. You can use the application below to check your answers: Binary! (Base-2) On to the famous base-2, also called binary. While everyone knows binary is made up of 0s and 1s, it is important to understand that it is no different mathematically than any other base. There's an old joke that goes like this: Can you figure out what it means? Let's try a few conversions with base-2. First, we'll convert 1011002 to base-10. We have: 101100 = 1*25 + 1*23 + 1*22 = 32 + 8 + 4 = 4410. Now let's convert 65 to binary.

26 is the highest power of 2 less than 65, so: 65/26 = 1 remainder 1

Question: How is the value of eight expressed in a base eight numbering system?
Answer: 10