Topic 1e
CFU Answers
Checking for Understanding
- Which of these two error types is caused by a limit in the number of bits at the low end of the bit string?
- Running out of bits at the low (fractional) end of a numerical encoding is a truncation error.
- Which of these two error types is caused by a limit in the number of bits at the high end of the bit string?
- Running out of bits at the high (integer) end of a numerical encoding is an overflow error.
- Which of these two error types is most likely to occur when we add two bit strings together?
- When we add to values together we typically increase the value stored.
- Thus, we are likely to exceed the maximum value able to be stored by the bit-string.
- Thus, we have an overflow error.
- Which of these two error types is most likely to occur when we attempt to encode a number like Pi into binary?
- Pi is a number that never terminates in the decimal portion of the number.
- Thus, we increasingly have smaller and smaller fractional values to encode
- Eventually, we run out of bits to encode these fractional values.
- Thus, we have a truncation error.
- Which of these two error types is most likely to occur when we store decimal (base 10) numbers like money values in a binary encoding?
- Fractional values in decimal are 1/10, 1/100, 1/1000, etc.
- These don't always have good translations to fractional values in binary which are 1/2, 1/4, 1/8, 1/16, etc.
- Thus, it is sometimes hard to take a particular value like 1/100 and convert it to a sum of fractional powers of 2. We can't QUITE get there.
- Thus, we eventually run out of bits to encode increasingly smaller fractional values.
- Thus, we have a truncation error.