# decimal

## What is decimal?

Decimal is a numbering system that uses a base-10 representation for numeric values. The system is used extensively in everyday life to carry out routine tasks such as buying groceries, trading stocks, tracking football scores or scrolling through cable channels. Numbers such as 7, 28, 199 and 532.11 are all examples of decimal numbers. The decimal system is also referred to as the Hindu-Arabic system. Additionally, the term decimal is often used to refer to a fraction that is represented as a number in the decimal system, such as 19.368.

The decimal system consists of 10 single-digit numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. The number 9 is followed by 10, which is followed by 11, then 12, and so on. The number on the left is incremented by 1 each time the digit to the right goes beyond 9. For example, 20 follows 19, 30 follows 29, 100 follows 99, and 1000 follows 999.

The decimal system includes both integers and fractions. A fraction in decimal notation includes a decimal point, followed by the fractional component. For example, 5 3/4 can be represented as 5.75 in decimal notation.

## What is a digit's value in a decimal number?

A digit's value in a decimal number depends on its position. For example, each digit, moving from right to left, is 10 times greater than the previous digit:

- 1,000 is 10 times greater than 100.
- 100 is 10 times greater than 10.
- 10 is 10 times greater than 1.
- 1 is 10 times greater than 0.1.
- 1 is 10 times greater than 0.01.
- 01 is 10 times greater than 0.001.

Each digit moving from left to right is 1/10 the value of the previous digit. For example, 0.0001 is 1/10 of 0.001.

Because the decimal system is a base-10 representation, it's easy to convert very large decimal numbers to scientific notation. For example, the number 785,000,000,000,000 (785 trillion) can be simplified to 9.65 × 10^{14}. When converting a number to scientific notation, a core number is identified first (in this case, 9.65) and multiplied by the number by 10, raised to the power of the decimal's repositioning. In this case, the decimal point is being moved 14 digits to the left, so 10 is raised to the power of 14.

A similar approach can be taken to convert a very small number to scientific notation. For example, the decimal number 0.00000000000785 converts to 9.65 × 10^{-12} in scientific notation. Notice that the exponent for 10 is a negative number because the decimal point is being moved 12 digits to the right.

## Decimal vs. binary vs. octal vs. hexadecimal numbering systems

In computing, the binary, octal and hexadecimal number systems are often used instead of the decimal system. Binary is a base-2 system (0-1), octal is a base-8 system (0-7) and hexadecimal is a base-16 system (0-9 and a-f). The table lists the decimal numbers 0 to 20, along with their binary, octal and hexadecimal equivalents, based on single-byte binary values.

Decimal |
Binary |
Octal |
Hexadecimal |

0 |
00000000 |
000 |
00 |

1 |
00000001 |
001 |
01 |

2 |
00000010 |
002 |
02 |

3 |
00000011 |
003 |
03 |

4 |
00000100 |
004 |
04 |

5 |
00000101 |
005 |
05 |

6 |
00000110 |
006 |
06 |

7 |
00000111 |
007 |
07 |

8 |
00001000 |
010 |
08 |

9 |
00001001 |
011 |
09 |

10 |
00001010 |
012 |
0A |

11 |
00001011 |
013 |
0B |

12 |
00001100 |
014 |
0C |

13 |
00001101 |
015 |
0D |

14 |
00001110 |
016 |
0E |

15 |
00001111 |
017 |
0F |

16 |
00010000 |
020 |
10 |

17 |
00010001 |
021 |
11 |

18 |
00010010 |
022 |
12 |

19 |
00010011 |
023 |
13 |

20 |
00010100 |
024 |
14 |

To convert a binary, octal or hexadecimal value to a decimal number, take each digit and multiply it by the base-system value (i.e., 2, 8 or 16), raised to a power based on digit's position in the number. The position is calculated from right to left, starting with 0 and incremented by 1. After calculating the individual digits, add the products together.

For example, the following set of equations demonstrate how to convert the binary value 10011101 to a decimal number:

(10011101)_{2} = (1 × 2⁷) + (0 × 2⁶) + (0 × 2⁵) + (1 × 2⁴) + (1 × 2³) + (1 × 2²) + (0 × 2¹) + (1 × 2⁰)

(10011101)_{2} = 128 + 0 + 0 + 16 + 8 + 4 + 0 + 1

(10011101)_{2} = (157)₁₀

The first equation includes an expression for each of the eight digits in the original binary number. The digit is multiplied by 2 (the base), raised to a power that reflects its position. Because there are eight bits in the binary value, the exponents start with 0 and end at 7, moving from right to left. After adding the products together, the sum should be a decimal value of 157.

*See **how to convert binary to decimal and vice versa** and learn about **binary-coded decimal and how it is used**.*