Special Number Types

7. Special Number Types#

When performing computational work, it’s crucial to be aware of potential floating-point errors. These are inaccuracies caused by the finite way computers store and handle numbers. This link highlights a few tragic, real-world disasters that occurred due to floating-point errors.

To avoid such issues, it’s sometimes necessary to increase the precision, or the number of digits used to represent a number. This chapter introduces special number types that allow for arbitrarily high precision in calculations.

We will also discuss two other commonly used number types: complex and rational numbers. Just as mathematicians work with different sets of numbers (integers \(\mathbb{Z}\), rationals \(\mathbb{Q}\), reals \(\mathbb{R}\), complex \(\mathbb{C}\), etc.), it is essential to know how to work with their corresponding data types when programming.