Numerical computations performed by computers or microcontrollers are done with a **rounding error**. Mathematical operations can be performed with either integer numbers or fractional numbers. When using integer numbers the calculations are performed in **fixed point**. In this case, if the mathematical operation is either addition, subtraction or multiplication, there is no rounding error. This is true because integer numbers have an exact representation in computers/microcontrollers.

Division brings additional complexity because dividing an integer number to another integer can result in a **fractional number**. In this case, numbers are represented in **floating point**.

Having a number *A*, with an **exact value**, and a number *a*, as the **approximation** of *A*, we can define the **absolute error** *ε* as:

**Relative error** *η* is the ratio between the **absolute error** *ε* and the absolute value of the exact number:

Replacing the formula of the absolute error (1) in (2), we get the mathematical expression of the relative error function of the exact number and its approximation:

\[\eta ={\frac {\epsilon }{|A|}}=\left|{\frac {A-a}{A}}\right|=\left|1-{\frac {a}{A}}\right|\]**Example 1**. For the numbers *A = 0.0005* and *a = 0.0004* calculate the absolute and the relative error.

**Example 2**. For the numbers *A = 999* and *a = 1000* calculate the absolute and the relative error.

The absolute and relative errors are very important parameters of **numerical solvers**. Any numerical simulation package (e.g. Scilab/Xcos) allows the user to set the **accuracy** of the numerical solver, by adjusting the values of the **absolute and relative errors**.

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!

## Suthar Jayesh

x-engineer.org such a great article, clear cut explanation. But I’m still not getting why and where to use relative error?? What is the use of that??