Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abstractmachines/2b76c4efa3a3f40c611413b1bb24a55a to your computer and use it in GitHub Desktop.
Save abstractmachines/2b76c4efa3a3f40c611413b1bb24a55a to your computer and use it in GitHub Desktop.
The Base Is The Place: A tutorial on radix for students of systems engineering

WIP

The Base Is The Place: Understanding Radix

How to understand radix: A tutorial for students of systems engineering

Radix : Number of unique digits that exists in a system.

Binary "base 2" : the number 2 is 0010

Note the binary number 0010. Binary is read RTL or right-to-left.

0 0 1 0
8 4 2 1

RTL, that is: ( 0 * 1 ) + ( 1 * 2 ) + ( 0 * 4) + 0 * 8 = 2

So the result is 2.

Decimal "base 10" : the number 2 is 0002, or just 2

What 2 would that look like in decimal? It would look like this: 0002, or just 2.

0 0 0 2
30 20 10 1

So the radix for the decimal system is 10. This means that in each place, you count up from 0-9. Once you hit 10, you go to the next "place", and you increment that number from a 0 to a 1 (and leave the place you were just at, empty).

This is accepted knowledge for most people when it comes to the decimal system. The binary system is a bit different and takes some getting used to. There are other systems as well, including octal and hexadecimal.

Base64 encoding : the number 2 is 0002, or just 2

What "this is a Base64 file" means:

Base 10 means each "decimal place" increments by 10. Then, you move to the next decimal place. Right?

Same thing with base64. What that means, as you can imagine, is that you count from 0-63 in the first place, then, when you want to get to 64, you go to the next place, and change that number to a 1.

Examples of use of Radix for web developers

JS parseInt() function (2nd arg is base)

Base means radix.

re: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment