Why do we use other bases which are neither binary (for computers) nor decimals (for humans)?
Computers end up representing them in binary, and humans strongly prefer getting their decimal representation. Why not stick to these two bases?
Why do we use other bases which are neither binary (for computers) nor decimals (for humans)?
Computers end up representing them in binary, and humans strongly prefer getting their decimal representation. Why not stick to these two bases?
Octal (base-8) and hexadecimal (base-16) numbers are a reasonable compromise between the binary (base-2) system computers use and decimal (base-10) system most humans use.
Computers aren't good at multiple symbols, thus base 2 (where you only have 2 symbols) is suitable for them while longer strings ,numbers with more digits, are less of a problem. Humans are very good with multiple symbols, but aren't that good in remembering longer strings.
Octal and hex use the human advantage that they can work with lots of symbols while it is still easily convertible back and forth between binary, because every hex digit represents 4 binary digits ($16=2^4$) and every octal digit represents 3 ($8=2^3$). I think hex wins over octal because it can easily be used to represent bytes and 16/32/64-bit numbers.
We use them for convenience and brevity.
Hex and Oct are really outstanding compressed representations of binary. Hex in particular is well suited to condensed forms of memory addresses. Every oct digit directly maps to 3 binary bits and every hex digit to 4 binary bits. This is a result of the bases (8 and 16) being powers of 2 ($2^3$ and $2^4$). For example, I can write binary $01101001$ as hex $69$ or if I extend it with a leading zero as oct $151$.
So, say you need a 64 bit memory addresses. You can either look at all 64 binary bits, or get it condensed to 16 hex digits. Often you don't need to compare a few addresses to see if their the same or contiguous. Would you rather look at 64 bits or 16 digits?
Binary numbers in text are a waste of space.
Decimal shows no relation to powers of $2$. Often the fact that a number is, say $5\cdot 2^n-1$, is more important than how much that is.
As already mentioned by other answers, there can be different notations for different purposes and constraints. Notations is actually an encoding as a sequence of characters, and we know from the study of algorithms and data structure that there are many ways we can encode abstract concepts, a list or a set for example, depending on what we want to do with it. In this case it is mostly algorithmic convenience.
When considering representation of numbers, the same applies. Inside the computer, everything is binary at the lowest level, though stranger representations can be used for some applications.
Outside the computer, we use any kind of human understandable representation, depending on human convenience regarding the kind of value represented. Binary representation is often too long and unstructured to be read and written easily, thus making place to hexadecimal or octal. The choice may often have to do with the way information is structured in a binary word, which is not necessarily intended to represent a number.
But, when considering only numerals, i.e. representation of numbers, it is worth looking at other number representation systems to understand that major factors are: physiology, habit, and convenience. Convenience is of course the leading factor creating diversity, as it depends on context of use.
It is surprising that all answers so far consider only decimal and base $2^n$ systems, mostly binary, octal and heaxdecimal.
The body of the question seem in no way restricted to computers, and humans have been and are still using several other numeration systems. Some of them are even used within computers, for example when dealing with long integers (not to mention non integer numerals).
A first remark is that when people count in thousands, or millions as a unit, this is still considered decimal, because these are powers of 10. So one might wonder why octal or hexadecimal should not be considered just a variation on binary. One possible reason may be the number of symbols used to represent numbers (though that is disputable issue, as we shall see with other systems).
Then, regarding humans, they using several system in base 5, called quinary systems. Actually, most of these system are with two bases, the second one being 2 or 4, alternating with the base five, which makes them equivalent to base 10 (decimal) or base 20 (vigesimal). Guess where that comes from :)
These double-base systems are called bi-quinary or quadri-quinary systems. Pure quinary is rarely used.
Roman numeral may be seen as bi-quinary system (which is an indication on how to do arithmetics with them). Chinese and Japanese abacus use bi-quinary. Quadri-quinary was used by the Mayas.
The reason for using a system are probably many. One good reason is that it was the first local design, and people are now used to it. For example, one might wonder as well why English speaking people are still using an extremely weird numeration system when trying to measure distances. You could argue thet it is a matter of multiple units, not numbering, but that is a very weak remark. Numbers are used mainly to measure things.
Other reasons for keeping a system is convenience in a given context. There may be a trade-off between the number of different symbols, or positions on an abacus, and the number of symbol occurencess required to form sufficiently large numbers. Base 2 works with 2 distinct symbols, but has lots of occurences, which may be inconvenient for a material representation. Vigesimal base 20 would require twenty symbols, and very big multiplication tables that people would not remember. But a bi-quinary or quadri-quinary system is a lot more manageable, especially to build abacus. Pure quinary system would probably be even better, but it goes against physiology based habits and intuition. And it is always nice to be able to use our fingers to count with, when we do not know any better.
But that is not all.
One very old and very common system is the sexagesimal system used to measure time and angles (but we know they are related, through Earth rotation). It uses base 60, but does not use 60 symbols as that is far too many. So it relies on another system to represent its synbols (such as the decimal system).
The circle can be divided in 6 parts corresponding to 60 degrees angles, which are the simplest to build with equilateral triangles. Then Each degree is 60 minutes of arc, each divided in 60 seconds.
According to wikipedia
It originated with the ancient Sumerians in the 3rd millennium BC, it was passed down to the ancient Babylonians, and it is still used —in a modified form —for measuring time, angles, and geographic coordinates.
Considering the origin it was a pretty convenient system, at a time when mathematics were hardly entering infancy. Not only is the 60⁰ angle easy to draw, but 60 has a lot of factors, so that it allowed for dividing in many way with integers, without a remainder.
Physiologically, it can be related to a duodecimal-quinary system, base 12 and 5. Base 12 is convenient as it can be used when counting on finger bones of 4 fingers with the thumb of the same hand. Then the fingers of the other hand give the quinary component. And $12\times 5=60$.
But there are other ways to get to 60, such as the vigesimal-ternary system of Babylonians.
Why do we still use the sexagesimal system. I guess we are just used to it, and we may have too many conflicting issues for a change to be fully justified.
It is interesting to note that there is much interplay between numbering systems and unit systems. But this is to be expected since measure is a major role for numbers. This is noticeable in the opposition between the decimal and binary metrics for memory size.
Computers understand binary numbers and in binary, the weights of the number are in power of 2, therefore the number of digits to represent a number may be large depending on the number.
Say, 64 in decimal can be represented by 7 bits whereas to represent number 5000 we require 13 bits.
Octal and hexadecimal number system are compact way of representing a binary number.
[What advantage is there to using a base different from ten or (a power of) two?]
- or how else do you interpret Why not stick to [bases 2 and 10]?
?
$\endgroup$
Commented
Jan 12, 2020 at 22:40