number system
(Redirected from number systems)

A number system is a mathematical notation for representing numbers of a given set. They are the foundation for conveying, quantifying, and manipulating data.

Number systems are mainly classified according to notations (positional notation vs sign-value notation) and their base. Today, we largely use the Arabic numerals which is a base-10 positional notation numbering system. Machines on the other hand may use a different number system - such as the binary number system.

## Notation

In the positional notation, numbers are a string consisting of one or more juxtaposed digits. For example, fixed-point form number N takes the following form:

${\displaystyle N_{r}=(d_{n-2}d_{n-1}\cdots d_{2}d_{1}d_{0}\cdot d_{-1}d_{-2}d_{-3}\cdots d_{-m})_{r}}$

Where r is the radix or base. The base represents the number of digits in the number system. d are the digits defined for that given radix. The dot in the center () is known as the radix point. It separates the integer part on the left from the fractional portion on the right. Furthermore, the value of number N in base r can be represented in polynomial form as

${\displaystyle N_{r}=\sum _{i=-m}^{n-1}d_{i}r^{i}=(d_{n-2}r^{n-2}+d_{n-1}r^{n-1}+\cdots +d_{1}r^{1}+d_{0}r^{0}+d_{-1}r^{-1}+d_{-2}r^{-2}+d_{-m}r^{-m})_{r}}$

Where d is the digit in the ith position. When a number has no fractional portion, the number can be more accurately called an integer. Conversely, if a number has no integer part, it is called a fractional number or simply a fraction.

On various occasions, a number might be written in the form ${\displaystyle N_{r}}$ where the subscript r is the radix of number N. Subscripts are used to indicate a base; often, to avoid confusion, when presenting values in different basis.

### Decimal Number System

Main article: decimal

For the most part, humans use the decimal number system (base-10) for all day-to-day activities. It is the number system we learn and grow up with hence the most familiar to us. In a base-10 number system there are 10 distinct digits: ${\displaystyle \{0,1,2,3,4,5,6,7,8,9\}}$. Consider the following number ${\displaystyle 49835.5825_{10}}$. Note the 10. We can express that number in polynomial form as

{\displaystyle {\begin{aligned}N_{10}&=49835.5825\\&=(d_{4}d_{3}d_{2}d_{1}d_{0}\cdot d_{-1}d_{-2}d_{-3}d_{-4})_{10}\\&=4\times 10^{4}+9\times 10^{3}+8\times 10^{2}+3\times 10^{1}+5\times 10^{0}+5\times 10^{-1}+8\times 10^{-2}+2\times 10^{-3}+5\times 10^{-4}\\&=40000+9000+800+30+5+0.5+0.08+0.002+0.0005\\&=49835.5825_{10}\end{aligned}}}

Now consider the fractional decimal number ${\displaystyle 0.938_{10}}$. Since there is no integer part, our exponents start at 0 and decrease with each additional digit:

{\displaystyle {\begin{aligned}N_{10}&=0.938\\&=(d_{-1}d_{-2}d_{-3})_{10}\\&=9\times 10^{-1}+3\times 10^{-2}+8\times 10^{-3}\\&=0.9+0.03+0.008\\&=0.938_{10}\end{aligned}}}

### Binary Number System

Main article: binary

In the binary number system, the radix is 2 - i.e. a number system capable of only representing two discrete values: ${\displaystyle \{0,1\}}$. Let's consider the following number ${\displaystyle 10101110.011_{2}}$. Note that the subscript is 2. We can express this binary number in polynomial form as follows:

{\displaystyle {\begin{aligned}N_{2}&=10101110.011\\&=(d_{7}d_{6}d_{5}d_{4}d_{3}d_{2}d_{1}d_{0}\cdot d_{-1}d_{-2}d_{-3})_{2}\\&=1\times 2^{7}+0\times 2^{6}+1\times 2^{5}+0\times 2^{4}+1\times 2^{3}+1\times 2^{2}+1\times 2^{1}+0\times 2^{0}+0\times 2^{-1}+1\times 2^{-2}+1\times 2^{-3}\\&=128+32+8+4+2+0.25+0.125\\&=174.375_{10}\\\end{aligned}}}

Note that as part of the process we've actually converted the number to decimal.

### Octal Number System

Main article: octal

The octal number system as the name implies uses radix of 8; i.e. the number system is represented via 8 discrete values: ${\displaystyle \{0,1,2,3,4,5,6,7\}}$. Let's take the number ${\displaystyle 703.104_{8}}$,

{\displaystyle {\begin{aligned}N_{8}&=703.104\\&=(d_{2}d_{1}d_{0}\cdot d_{-1}d_{-2}d_{-3})_{16}\\&=7\times 8^{2}+0\times 8^{1}+3\times 8^{0}+1\times 8^{-1}+0\times 8^{-2}+4\times 8^{-3}\\&=448+3+0.125+0.0078125\\&=451.1328125_{10}\end{aligned}}}

An interesting property of a base-8 system being ${\displaystyle 2^{3}}$ is that converting a number from binary to octal can easily done by breaking the number number into groups of 3 bits and converting each group individually into octal. Octal being 8 values means each group of 3 binary bits equates to a single octal digit. For example consider the following number ${\displaystyle 1010011101_{2}}$. We can break the number into groups of 3 bits: ${\displaystyle [001]_{2}[010]_{2}[011]_{2}[101]_{2}}$. Each of those groups can now be converted to octal independently: ${\displaystyle [1]_{8}[2]_{8}[3]_{8}[5]_{8}=1235_{8}}$. Note that the conversion from octal back to binary can just as easily be done by simple converting each individual octal digit back into a group of 3 binary digits.

The Hexadecimal number system or base-16 has 16 discrete digits. Those digits have traditionally been ${\displaystyle \{0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F\}}$. Note that A through F are decimal 10 through 15, respectively. In this example we'll use the hex number ${\displaystyle FDAE.F5F_{16}}$.
{\displaystyle {\begin{aligned}N_{16}&=FDAE.F5F\\&=(d_{3}d_{2}d_{1}d_{0}\cdot d_{-1}d_{-2})_{16}\\&=F\times 16^{3}+D\times 16^{2}+A\times 16^{1}+E\times 16^{0}+F\times 16^{-1}+5\times 16^{-2}+F\times 16^{-3}\\&=15\times 16^{3}+13\times 16^{2}+10\times 16^{1}+14\times 16^{0}+15\times 16^{-1}+5\times 16^{-2}+15\times 16^{-3}\\&=61440+3328+160+15+0.9375+0.01953125+0.003662109375\\&\cong 64943.9606934_{10}\end{aligned}}}
Note that the final value is rounded as a result of fraction estimation. Note that just like octal is also a power of 2 (${\displaystyle 2^{4}}$), meaning conversion from binary to hex can be done by simply breaking down a binary number into groups of 4 bits and converting each group individually. For example, consider the number ${\displaystyle 101101011110001_{2}}$ which can be broken down into ${\displaystyle [0101]_{2}[1010]_{2}[1111]_{2}[0001]_{2}=[5]_{16}[A]_{16}[F]_{16}[1]_{16}=5AF1_{16}}$. Converting a number back from hex to binary is done by simply converting each individual hex digit back into a group of 4 bits.