Theiling Online    Sitemap    Conlang Mailing List HQ

# Re: OT: Need help with numeric bases

From: Apollo Hogan Wednesday, February 26, 2003, 11:47
```On Tue, 25 Feb 2003, Robert B Wilson wrote:
>
> hmm... what about non-integer bases?
>
Well, the same idea should still work, assuming that our
'base' makes sense.  (For example, choosing base 1/2
doesn't work, since it doesn't give unique representations
of numbers, e.g.
1(dec) = 0.2(base 1/2) = 0.04(base 1/2) = 0.008(base 1/2)
if we interpret this in the obvious way.)

But assuming we get unique representation with a base
(and a set of possible digits: it is possible to use a
ternary representation with digits +1, 0, -1, for example
counting from -5 to 5 is: (where we let - stand for -1)
-11, --, -1, -, 0, 1, 1-, 10, 11, 1--  )

Anyway, To see what happens, let's formalize what we're doing
(and then maybe we'll see what goes wrong.)
So fix a base b.  Then by the string
a_n a_{n-1} ... a_1 a_0 . d_1 d_2 d_3 ... d_m
we'll mean the number
a_n * b^n + a_{n-1} * b^{n-1} + ... + a_0
+ d_1 * b^{-1} + d_2 * b^{-2} + ... + d_m * b^{-m}
(ie the digits just give the coefficients of the different
powers of our base.)
Now, notice that when we multiply the number by b, we just
shift the coefficients:
b * ( d_1 * b^{-1} + d_2 * b^{-2} + ... + d_m * b^{-m} )
= d_1 + d_2 * b^{-1} + ... + d_m * b^{-m-1}

So all we need to do is to be able to recognize what part of
a number is _not_ multiplied by any (negative) power of b.

I'll leave it as an exercise to figure out how to write
Pi in base (1+i) :-)

Ciao,
--Apollo
```