I have an homework question but I'm having hard time to understand the context. Here is the question:
- Assume that you are using 3-digit number system with base r = 4 (and n = 3). Assume also that you are using four’s complement scheme to represent signed integers and for subtraction operation.
a. Show the range of integers that can be represented 4s complement signed number system.
In the (a), I tried to use formula that I derived from 2's complement but it seems that somehow it's not correct. $$[-4^{n-1},4^{n-1}-1]$$
This formula gives [-16,15] but shouldn't the numbers whose leading digit is 0 and 1 be positive? That gives positive numbers from 0 to 31, but I don't know what to do with the negative ones.
This is the idea of the $r$'s complement scheme.
Namely, say we have some base $r$ in which we have $n$-digit numbers. Normally these numbers would be identified with $[0,r^n-1]$, e.g. $r=2,n=4$ gives you numbers
which are (in base 10) equal to $[0,31]=[0,r^n-1]$.
But, when we use $r$'s complement scheme, the first digit of our number in base $r$ will indicate the sign of that number, e.g. again with $r=2, n=4$:
will be equal to -1. This should explain your interval $[-16,15]$