Slide 1

Slide 1 text

ABSOLUTE AND RELATIVE ERRORS

Slide 2

Slide 2 text

Errors ■ When calculating floating point numbers in binary we can run into errors of precision. We experienced this in the tasks we did when working with floating point numbers. ■ There are two types of errors that we can calculate: – Absolute Error – Relative Error

Slide 3

Slide 3 text

Errors ■ The absolute error is the magnitude of the difference between the exact value and the approximation. ■ The relative error is the absolute error divided by the magnitude of the exact value. ■ We represent this as a percentage relative error expressed in terms of per 100.

Slide 4

Slide 4 text

Absolute Error Example ■ Let’s say for example we are trying to represent the number: 8.910 in binary. ■ The closest possible representation we can display is: 0.10001112 01002 ■ The absolute error is the difference between the expected value of 8.910 and the representation above. ■ Calculate the absolute error.

Slide 5

Slide 5 text

Relative Error ■ If our absolute error was 2cm for instance and we were expecting 5cm but we arrived at 3cm, then this is an error that is out by quite a distance. ■ Alternatively if we were out by 2cm and we were expecting a result of 12000cm but arrived at 11998cm, relatively speaking we were not out my that much, hence the term relative error.

Slide 6

Slide 6 text

Relative Error Example ■ Let’s look at our previous example where we were trying to represent the number: 8.910 in binary. ■ The closest possible representation we could display was: 0.10001112 01002 ■ We calculated the absolute error and arrived at 0.025 ■ The relative error is calculated as follows absolute error 0.025 expected 8.9 ■ Ensure when you calculate the relative error, you convert it into a percentage by moving the decimal place two places to the right. = = 0.0028 = 0.28%

Slide 7

Slide 7 text

Task ■ In a computer system, the closest representation of 5.6510 is: 0.10110002 00112 ■ Calculate the absolute error and the relative error.