Data Representation: Absolute and relative errors

Errors occur when trying to represent numbers wit a fractional part with a set number of bits, as some numbers cannot be accurately represented e.g. 0.1

Absolute errors

The absolute error is precisely how far away from the actual number that was trying to be represented are we. Lets look at an example using fixed point binary with 4 bits for the whole number and 4 for the part. We will try to represent 0.7.

8 4 2 1 .5 .25 .125 .0625
0 0 0 0 1 0 1 1

The closest we can get to 0.7 is 0.6875.

0.7 - 0.6875 = 0.0125 and this is the absolute error trying to represent this number in this way

Relative errors

The relative error is the error expressed as a percentage of the original number you were trying to represent. This is a better way to judge accuracy as it tells you how far off the estimate used is.

So for our example above, the relative error would be 0.0125/0.7 * 100 = 17.8571428571%

Calculate the absolute and relative error practice

Here is a table with the values that can be represented in 8 bits with 4 for the whole and 4 for the part

8 4 2 1 .5 .25 .125 .0625
 

Calculate the absolute and relative error in each case below of trying to represent the number in fixed point binary with four places for the whole number and four for the part (Round to a maximum of 5 decimal places, relative error as a percentage also to 5 decimal places):

Number to represent   Absolute error      Relative error   
0.333

?

?

3.4

?

?

5.8

?

?

14.1

?

?

7.7

?

?

The importance of errors

A small absolute error e.g. .05 is not very important in creating a very large number, but the importance of it increases for numbers close to 1. When it comes to very small decimal numbers, even what may seem a small error may have a large relative effect.

A small relative error can have a much larger effect when applied to a very large number. If you consider the recent feet of landing a device on a moving comet, a small reative error in a calculation applied to distances such as the ones travelled becomes a large absolute error.

© All materials created by and copyright S.Goff