Skip to content
{{ message }}

Instantly share code, notes, and snippets.

# abstractmachines/the-base-is-the-place-understanding-radix.md

Last active Jun 17, 2020
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.

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