Re: OT: Need help with numeric bases
From: | Robert B Wilson <han_solo55@...> |
Date: | Tuesday, February 25, 2003, 22:06 |
On Mon, 24 Feb 2003 21:55:04 -0800 Apollo Hogan
<apollo@...> writes:
> One can also do it with Multiplication: to convert x to base b,
> just
> iteratively apply the following steps: (Assuming 0<=x<1 already)
> 1) multiply by b
> 2) the result will have an integer part between 0 and b-1
> (inclusive);
> that is the next digit of your base-b rep
> 3) replace x with its fractional part
>
> For example, to convert 0.125 to base 7, we get:
> rep x x*7
> 0. 0.125 0.875
> 0.0.. 0.875 6.125
> 0.06.. 0.125 0.875
> etc. Here we get a repeat already, so we see that 0.125 (base 10)
> is
> written as 0.0606060606... in base 7.
>
> A more interesting example, write PI in base 12: (We first strip
> off the
> integer part 3)
> rep x x*12
> 3. 0.1415926.. 1.69911184..
> 3.1 0.69911184.. 8.38934211..
> 3.18 0.38934211.. 4.67210540..
> 3.184 0.67210540.. 8.06526483..
> 3.1848
> etc. ad nauseum; hence PI = 3.1848... in base 12.
hmm... what about non-integer bases?
> --Apollo
Robert Wilson
han_solo55@juno.com
http://kuvazokad.free.fr
fanai kabl dala ninl.
Reply