I read some articles and books recently where the authors were explaining – with some insurance – how the numbering systems we use as humans and in computer science were randomly/arbitrary chosen…
That put me so much on my nerves… so so much…
I already have an issue with people throwing “words of truth” like this but when they are in a ‘follow what I know and discovered all by myself’ this is getting worse… lol…
And this can be easily found out by anyone who just takes the time to think about it instead of trusting some ‘illuminated’ like this…
Why are we using decimal?
Why do we count from 1 to 10, and why our numbering system is based on these digits?
Just because we do have 10 fingers.
Hence the base 10 (0-9, even if the zero came at a later time).
The fingers are the easy tool we have since we are born. It allows us to quickly get a glance at how many things are surrounding us.
And as an addition: why the Mayan were using base 20 to count things. Because they were also taking their toes into account 😉
In the end, we use 10 symbols to represent numbers, from right to left.
When you move to the left you multiply by ten, when you move to the right you divide by ten.
Why computers use binary?
Computers don’t have fingers, right? 😉
But how do they express the values, the data they manipulate?
With two possible values: current is flowing or is not.
You can also see it as a switch.
Two symbols used to represent the two digits: 0 or 1.
And this is what we call a bit, the smallest computer unit.
You move one symbol left to multiply by two, one symbol right to divide by two.
What is BCD?
But for us humans, this is very annoying/cumbersome to represent computer numbers with a ton of 0s and 1s…
So we need to group them.
One first approach was to directly try to represent our decimal numbers as binary values… That’s what Binary-coded Decimal (BCD for short) was designed for.
So let’s look:
if we want to represent our 0 to 9 values in binary, using 3 bits is not enough as it only allows to represent 8 values (2^3 -> 0-7) so we use 4 bits (2^4 -> 0-15) but we won’t use all the possibilities of these four bits.
0 = 0000
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
7 = 0111
8 = 1000
9 = 1001
Octal and Hexadecimal
This gives us the hint for the two other numbering systems also used in computer science: Octal (3 bits, 0 to 7) and Hexadecimal (4 bits, 0 to F as the first alphabetical letters are used to replace values from 10 to 15).
On one side we decide to represent less than 10 numbers, on the other side we decide to represent more than 10 numbers.
Moving the digits one place left or right is like multiplying/dividing by 8 for Octal or by 16 for Hexadecimal.