Well, you just need to calculate the range for each case and find the lowest power 2 that is above that range.
For example, in i), 3 decimal places β 10 ^ 3 = 1000 possible numbers, so you need to find the lowest power 2 exceeding 1000, which in this case is 2 ^ 10 = 1024 (10 bits).
Edit: Basically, you need to find the number of possible numbers with the number of digits that you have, and then find how many numbers (in another base, in this case, base 2, binary) have at least the same possible numbers, such as a number in decimal form.
To calculate the number of possibilities given the number of digits: possibilities=base^ndigits
So, if you have 3 digits in the decimal system (base 10), you have the possibility of 10^3=1000 . Then you need to find a few digits in binary format (bit, base 2) so that the number of possibilities is at least 1000, which in this case is 2^10=1024 (9 digits are not enough, because 2^9=512 , which is less than 1000).
If you generalize this, you have: 2^nbits=possibilities <=> nbits=log2(possibilities)
Which applies to i) gives: log2(1000)=9.97 , and since the number of bits must be an integer, you must round it to 10.
guardianpt Aug 22 '11 at 15:52 2011-08-22 15:52
source share