Describe using examples the following computational errors.
i) Overflow
ii) Truncation
iii) Rounding off.
Answer:
- Overflow: it occurs if the result from a calculation is too large for the allocated memory space. Example if a byte is represented using 8 bits, an overflow will occur if the result of a calculation gives a 9-bit number.
- Truncation-it results when the computer cuts off the extra characters from the fractional/decimal part of number. Examples: A number such as 5.12354678 can be truncated to three decimal places to become 5.123.
- Rounding off-it results from expressing a number to the nearest whole number or multiple of ten or five. Example: if 34.23476 is rounded off to four decimal places it becomes 34.2348.