Irrational Numbers
Understanding Irrational Numbers
- Irrational numbers are numbers that cannot be expressed as a ratio of two integers.
- Their decimal representation is neither terminating nor repeating. In other words, the decimal goes on forever without repeating a pattern.
- Quite a few well known numbers are irrational, including Pi (π), Euler’s number (e), and the square root of two (√2).
- Any number that can’t be placed in a simple fraction or whole number is an irrational number.
Representing Irrational Numbers in Computers
- Since irrational numbers are infinite and non-repeating, they can’t be represented exactly in a computer, which has finite memory.
- We most often use approximations of irrational numbers in computing.
- For example, Pi is often approximated as 3.14159 in programming and computer calculations.
Encoding and Decoding Irrational Numbers
- Encoding an irrational number in a computer involves choosing an appropriate approximation and then representing that approximation in binary.
- Like rational numbers, these approximations are typically represented as floating-point numbers.
- Decoding an irrational number involves reversing the process – interpreting the binary as a floating-point number and then using the resulting approximation.
Importance of Irrational Numbers in Computing
- Despite their inability to be represented exactly, irrational numbers are immensely important in computer science and mathematics.
- They occur in many of the most important formulas in physics, engineering and theoretical mathematics.
- Understanding how they work is crucial, because the use of approximations can lead to round-off errors. These errors can accumulate and become significant in computations, especially in iterative processes. Understanding this helps to prevent or mitigate such errors.
- An awareness of the features of these numbers also helps in developing algorithms and solving problems that need high precision calculations.