This notebook contains an excerpt from the Python Programming and Numerical Methods - A Guide for Engineers and Scientists, the content is also available at Berkeley Python Numerical Methods.

The copyright of the book belongs to Elsevier. We also have this interactive book online for a better learning experience. The code is released under the MIT license. If you find this content useful, please consider supporting the work on Elsevier or Amazon!

# Chapter 9. Representation of Numbers¶

## Motivation¶

There are many ways of representing or writing numbers. For example, decimal numbers, Roman numerals, scientific notation, and even tally marks are all ways of representing numbers as shown in the following figure.

Mathematics has infinite precision when describing numbers. For example, 2 is precisely the number such that when you square it, the result is 2, the exact decimal representation of which requires an infinite number of digits. This presents a significant problem for computers, since they only have a limited amount of space to store numbers, and they cannot understand abstract notations of representing numbers more compactly.

In this chapter, you will learn about different representation of numbers and how they are useful for computers. Besides, we will introduce the roundoff errors that associated with the representation of numbers. By the end of the chapter, you should know and understand some representations of numbers that are used in computing, how to convert between them and decimal numbers, their primary advantages and disadvantages and the roundoff errors.