1
$\begingroup$

Working with fixed size integer representations, use a number system with b-complement notation, base b = 9 and n = 4 digits. What is the smallest number that can be represented in this number system? State the number in decimal, and also express it in this number system. I assume that it will be 0888 for max, and 8000 for min. If I am right, then what is the max number of integers that I can represent using this notation.

$\endgroup$
  • $\begingroup$ If you can calculate this for binary, you should be able to calculate this for any other base. $\endgroup$ – Yuval Filmus Oct 28 '18 at 19:22
  • $\begingroup$ I am not sure about the first digit, whether it is always 0 for positive and n-1 (in the context of base n) for negative, or it increases until some point. $\endgroup$ – Arsenij Pertsov Oct 28 '18 at 20:46
  • $\begingroup$ It's up to you – arithmetic will work whatever convention you use. $\endgroup$ – Yuval Filmus Oct 28 '18 at 21:30
0
$\begingroup$

As long as different 4 digit numbers in base b represent different decimal numbers, the particular notation one uses is not relevant to see how many integers can be represented. I'm not sure how the two-complement notation generalizes to the b-complement notation, but if the above property holds, then clearly there will be 9^4 representable integers.

My guess is that the first digit does not need to be 0 or 8, it can be any digit. That is, I think one could use the following encoding:

0000 0
...
4444 MAX
4445 MIN = -MAX
4446 MIN+1
...
8888 -1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.