# Binary and Hexadecimal : Number Format

This post will introduce number bases and how they are formatted. This will be a smaller series that will explain different number formats, where they are used, and why they are used. Understanding the structure of different number formats is important for a number of applications.

# Number Base

The first topic I should explain is the terminology “base”. This describes how many digits are available to use in different number representations. For example, our regular decimal number system uses 10 digits, a.k.a Base 10. The digits 0 through 9 are used in any number we can possibly represent in everyday use. There are infinite number formats because you can use Base 2 all the way to Base Infinity if you really wanted to, but this is not practical (or possible) and we really only use a few of the available formats because of convenience. Also, you can have a Base 1 represent numbers, but this is highly impractical because the number of digits to represent higher decimal numbers becomes ridiculous.

B^{n-1}: n=0...+\infty

Any Base B raised to the nth power minus 1 where n is between 0 and positive infinity.
N represents the number of digits present for the number formatted in the base specified. To represent a three digit number in Base 1, such as 100, you would need 99 other digits beyond 1^0 (any number raised to 0 = 1 except for 0 which is undefined), this makes up for the missing digit to add up to 100 (this also explains why the exponent has a minus 1 after it). The sum of the values of the available digits for Base B raised to the nth power have to add up to the final decimal equivalent. 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 would be the Base 1 equivalent of 100, not a very useful format at all.

All number formats with different bases have the above structure (commas are just for separation of “places”). I prefer calculating from left to right and the order of increasing exponents is right to left. Here is the formula for how total values in decimal equivalent are calculated:

V_{place}*B_{base}^{n}+V_{place}*B_{base}^{n-1}+...+V_{place}*B_{base}^{2}+V_{place}*B_{base}^{1}+V_{place}*B_{base}^{0}

“Vplace” stands for a value within the available digits the specific Base B allows (decimal allows 10 digits, binary allows 2, and hexadecimal allows 16). This is multiplied by the base we are working in raised to the exponent for each “place”.