Using non-standard bases
There are a number of different bases, or radices. Most of us use the decimal positional numeral system, i.e. base 10 for our everyday jobs. When it comes to computers most people use the binary, the hexadecimal or even the octal numeral system. However, there are a number of different “unusual” bases.
For example, there are negative bases. An example is the negadecimal positional numeral system, that is using the base -10. Converting a number from base -10 to base 10 is as simple as:
But why use such a base? It’s very simple, you can represent any number you want, positive or negative, without using a sign. For example:
The conversion from decimal to negadecimal is pretty simple. You continuously divide by -10 and keep the remainder as you would do with any other positional numeral system. For example:
So . Converting a positive number is done the same way too.
So . As you can see, there is no need for a sign symbol. And when using the negabinary numeral system there is no problem with signed and unsigned integers since there is no need for a sign bit!
But a negative base isn’t the only non-standard base. You can use complex numbers as bases too. This way there is no need to use a real and an imaginary part to represent a complex number. An example of such a base is where of course
. A number can then have the form
Using this base you can represent any complex you want without using the symbol.
Converting from this base to decimal is pretty simple, however the reverse is a little bit difficult. What you do for the convertion is divide continuously with as usual. The remainder will always be
or
. So, if the quotient is
then:
That means that if and
are both odd or even, then
, otherwise
. Then we continue the division of the quotient as usual.
Now let’s calculate the value of 2.
2 has both the real and imaginary part even, so .
The real and imaginary part are both odd, so again.
Since the real part is even and the imaginary is odd, . So, we can divide by the number minus 1 and the remainder will be 0.
Now, the real part is odd and the imaginary is even. So again . We divide by
so,
We now stop since . So we have
. Pretty cool!
Thinking how addition might look in base (-10) 9 + 1 = 190. Sort of like multiplication in Roman Numerals 🙂 My 7 year old daughter was freaked out by subtraction for a time so I gave her the trick of using base 10 complimentary addition. Never quite caught on.
cheers from a fellow kgdb user
–jc