# Decimal numeration system

The decimal numeral system, also referred to as the decimal number system or base-10 number system, is the most widely used number system in the world.

## Decimal system definition

The decimal system is a base-10 positional numeral system.

- Base - The base of a positional numeral system, also referred to as the radix, indicates the number of unique digits (including 0) used to represent numbers in the system. The decimal (base-10) system has 10 unique digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.
- Positional numeral system - a system for expressing numerals such that the position of the digit indicates the power of the base that the digit must be multiplied by to determine its value. For example, if the base is 10, the digit is 2 and is in the ones place, and its value is: 2 × 10
^{0}= 2 × 1 = 2.

### Place value

To understand how decimal numbers work, we need to understand place value. In a positional numeral system, the position of a digit determines its magnitude. The ones place is the place immediately to the left of the decimal point in a number. Each subsequent place to the left is b^{n} larger than the previous place, where b is the base and n is the position (counting the ones place as n = 0). To find the value of a given digit in a number, we multiply the number by its place value. For example, the integer 10 has a 1 in the tens place and a 0 in the ones place. We can expand 10 to show what it actually means in terms of the decimal numeral system:

10 = 1 × 10^{1} + 0 × 10^{0}

Similarly, 234 can be expressed as:

234 = 2 × 10^{2} + 3 × 10^{1} + 4 × 10^{0}

The charts below show the names of the positions used in the decimal numeral system and the corresponding powers of 10 used to determine their place value. The chart labeled "Whole Numbers" corresponds to digits that are left of the decimal point of a number.

Similarly, the chart labeled "Decimal Fractions" corresponds to digits to the right of the decimal point in a number.

Both charts above are not exhaustive; the Whole Numbers chart can extend further to the left for larger values such as trillions, quadrillions, etc, while the Decimal Fractions chart can extend further to the right to trillionths, quadrillionths, etc.

## Other positional numeral systems

The decimal numeral system is not the only positional numeral system. There are many others that function in this same way, except that they have different bases. For example, the binary system (base-2) has two unique digits: 0, 1. The hexadecimal system (base-16) has 16 unique digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, and F.

### Binary to decimal conversion

The binary system only uses two digits, 0 and 1, but the way the numeral system works is the same as the decimal system. To convert from binary to decimal, we relate the positions of the digits in the binary system to that of the decimal system by first noting the place in a binary number where a 1 occurs. For example, consider the binary number 10011. The first 1 on the right of the number is in the ones place, the 2nd from the right is in the tens place, the first 0 from the right is in the hundreds place, and so on. Anywhere that a 1 occurs, we determine the value by multiplying the place value by the digit (always 1), leaving just the place value itself. The sum of these places is the decimal value. Refer to the chart below:

Place value | 2^{}4 |
2^{}3 |
2^{}2 |
2^{}1 |
2^{}0 |
---|---|---|---|---|---|

Binary | 1 | 0 | 0 | 1 | 1 |

Decimal | 16 | 0 | 0 | 2 | 1 |

Thus, the decimal value of 10011 is 16 + 0 + 0 + 2 + 1 = 19.

### Decimal to binary conversion

To convert from decimal to binary, use the following steps:

- Determine the largest power of 2 that goes into the number you are trying to convert.
- Subtract the value of the power of 2 from the number.
- Find the largest power of 2 that goes into the remainder (if there is one) in step 2.
- Repeat this process of subtracting the value of the largest power of 2 from the remainder until there is no remainder.
- Each power of 2 represents the binary place value. For each power of 2 found, write a 1 in the corresponding place, and a 0 in all the surrounding places.

Example

Convert the decimal number 20 to binary.

- 2
^{4}= 16 - 20 - 16 = 4
- 2
^{2}= 4 - 4 - 4 = 0
- The largest power of 2 in the number was 2
^{4}, so this is the left-most binary place value. We fill in a 1 for the 2^{4}place, and a 1 for the 2^{2}place. The surrounding places are filled with 0, so the 20 in binary is: 10100

### Hexadecimal to decimal conversion

The hexadecimal numeral system, also referred to as hex, is a base-16 positional numeral system. The digits used are related to decimal digits as follows:

Decimal | Hex |
---|---|

0 | 0 |

1 | 1 |

2 | 2 |

3 | 3 |

4 | 4 |

5 | 5 |

6 | 6 |

7 | 7 |

8 | 8 |

9 | 9 |

10 | A |

11 | B |

12 | C |

13 | D |

14 | E |

15 | F |

To convert from hex to decimal, multiply each digit in a hex number by its place value and find the sum of the products. If the digit is a letter, convert it to its decimal equivalent.

Example

Convert A27 to decimal.

A is in the 16^{2} place and is the decimal equivalent of 10, 2 is in the 16^{1} place, and 7 is in the 16^{0} place, so:

10 × 16^{2} + 2 × 16^{1} + 7 × 16^{0} = 2,560 + 32 + 7 = 2,599

### Decimal to hexadecimal conversion

To convert from decimal to hexadecimal, use the following steps:

- Find the largest power of 16 that is less than or equal to X, the number we are converting.
- Determine how many times the power of 16 found in step 1 goes into X, and note the number of times.
- Subtract the product of the numbers found in step 1 and 2 from X. This new value is Y.
- Note that the number found in step 2 is the digit that will be written in the place value for the power found in step 1. If the largest power found in step 1 was 16
^{2}and the number found in step 2 was 5, then 5 would be written in the 16^{2}place.

- Note that the number found in step 2 is the digit that will be written in the place value for the power found in step 1. If the largest power found in step 1 was 16
- Repeat steps 1-3 using Y as the new starting value and continue the process until the remaining value is less than 16. This remaining value is written in the 16
^{0}place. - Write each value in its corresponding place to complete the conversion.

Example

Convert the decimal number 772 to hex.

- Largest power = 16
^{2}= 256 - 256 × 3 = 768, so 3 × 16
^{2} - 772 - 768 = 4
- 4 < 16, so 4 × 16
^{0} - Thus, 772 = 3 × 16
^{2}+ 0 × 16^{1}+ 4 × 16^{0}, and the hex value is 304.