You are in charge of the US Census for 2000. You must design computers to keep track of people. How many bytes should you devote to the population count?
Answer: There are about 281,000,000 people in the US. This requires 29 bits to represent, because 2^28 = 268,435,456 2^29 = 536,870,912
Challenge:
You are given a single byte, 8 bits, for storing signed, floating-point numbers. You have two choices:Answer the following questions for case A or case B:
- A: 1 bit for sign, 3 bits for a signed exponent, 4 bits for normalized mantissa
- B: 1 bit for sign, 4 bits for a signed exponent, 3 bits for normalized mantissa
- What is the largest positive value you can express?
- What is the smallest positive value you can express?
- What is the "average" spacing between values in your system? That is, what is the total range of positive values, divided by the number of different values inside that range?
- How many different values does your system have between the numbers 5.1 and 6.8?
Answer for Case A: I will use the convention that a "0" for a sign bit indicates "+", and a "1" for a sign bit indicates "-". Then we have sign mantissa sign exponent --------------------------------------- largest positive value: 0 1 1 1 1 0 1 1 1 1 1 1 +3 - + - + - + - 2 2 4 8 16 0.9375 x 8 = 7.5 smallest positive value: 0 1 0 0 0 1 1 1 1 -3 - 2 2 0.5 x 1/8 = 0.0625 Average spacing: There are 8 different values for the normalized mantissa (remember, the first digit must be "1"). There are 7 possible exponents: -3, -2, -1, 0, 1, 2, 3. That makes 56 combinations. The range of 0.0625 to 7.5, divided by 56 different values, yields an average spacing of about 0.13. How many values between 5.1 and 6.8? The exponent must be +3, since the mantissa must be at least 0.5. There are 8 possibilities to check: mantissa 1000 yields 0.5 * 8 = 4 1001 0.5625 * 8 = 4.5 1010 0.625 * 8 = 5 1011 0.6875 * 8 = 5.5 1100 0.75 * 8 = 6 1101 0.8125 * 8 = 6.5 1110 0.875 * 8 = 7 1111 0.9375 * 8 = 7.5 Three of these values fall into the desired range: 5.5, 6.0, 6.5.
Last modified 3/22/2001 by MWR.
Copyright © Michael Richmond. This work is licensed under a Creative Commons License.