P2 T1 L8 - Numerical errors Flashcards
Sometimes it is not possible to store an exact binary equivalent of the actual real number. (e.g. 1/3 as a decimal or binary)
This will affect the ________ of the stored numbers and introduce _________.
precision
errors
State the 7 error types
- Precision
- Absolute
- Relative
- Rounding
- Cancellation
- Underflow
- Overflow
Define precision error
(1 point)
Increasing significant bits used makes a number more accurate but reduces the exponent so the maximum size (number range) is _______
- When the number of bits used to represent the mantissa is too small to represent the number accurately.
reduced
e.g.
Implications of the following (Using 16 bits):
12 bit mantissa and 4 bit exponent more accurate but smaller number range
8 bit mantissa and 8 bit exponent less accurate but larger number range
Define absolute errors (1 point)
What is the formula for an absolute error?
- The difference between an actual number and the nearest value that can be represented
Absolute error = (actual value – approximation)
e.g.
A bag of apples weighs 474g. Unfortunately the scales can only measure to 450g or 500g.
The absolute error is the actual difference: 24
Define relative error (1 point)
What is the formula for relative error?
- A way of identifying the scale of an absolute error as a percentage
Relative error = Absolute error / actual value * 100
e.g.
A bag of apples weighs 474g. Unfortunately the scales can only measure to 450g or 500g.
The absolute error is the actual difference: 24
The relative error is
24 / 474 = 0.0506 * 100 = 5.06%
Define rounding errors
2 points
- Loss of value caused by rounding a number to nearest value that may be stored
- This may introduce an absolute error
E.g. 5.063291139240506 to 2dp is 5.06, in rounding we lost 0.003291139240506
When do cancellation errors occur?
1 point
- These occur during addition or subtraction of numbers of widely different sizes in a restricted number of bits
E.g. adding a very big number to a very small number.
(1.011x 2^8) + (1.1 x2^−5) = 1.011 x 2^8
Define underflow (1 point)
When might it happen? (1 point)
- A number is too small (close to zero) to be represented in available number of bits
- Might happen when you are dividing a small number by a very large number
E.g. represent .000002123456789 with 8 bits
Define overflow (1 point)
When might it happen? (1 point)
- A number is too large to be represented in available bits
- Might happen when you are multiplying two large values together
E.g. represent 2123456789 with 8 bits