There is a nice description of exponentiation in SICP:<div><a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4">http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4</a></div>
<div><br></div><div><a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-11.html#%_sec_1.2.4"></a>The number of multiplications required is in the order of O(log n) where n is the exponent.</div><div><br></div><div>
Enjoy the (inspiring) reading...</div><div>Bye</div><div>Enrico</div><div><br><div class="gmail_quote">On Sun, Apr 25, 2010 at 10:54, Igor Stasenko <span dir="ltr">&lt;<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">On 24 April 2010 10:55, Lawson English &lt;<a href="mailto:lenglish5@cox.net">lenglish5@cox.net</a>&gt; wrote:<br>
&gt; Lawson English wrote:<br>
&gt;&gt;<br>
&gt;&gt; Thanks. I had gotten that far with John Dougan&#39;s help and tried to save<br>
&gt;&gt; back to the repository but it wouldn&#39;t accept since I lack a password.   I<br>
&gt;&gt; converted all references of Floats to Fractions just to see if there was an<br>
&gt;&gt; easy way to give it higher precision but it slowed down to &lt; Apple ][ speeds<br>
&gt;&gt; when I did that.<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; Obviously the naive way isn&#39;t going to work. I gotta think there&#39;s some<br>
&gt;&gt; glitch with what I did, or incompatibility with the algorithm and<br>
&gt;&gt; Fractions....<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt; Or maybe  things like x^100/y^100   takes a rather long time to calculate...<br>
&gt;<br>
<br>
you can optimize, rather than multiplying x*x*...*x 100 times in a row,<br>
<br>
use a power of two numerics.<br>
Given that:<br>
x^y = (x^a)*(x^b)<br>
where y = a+b<br>
<br>
so,<br>
<br>
x^100 = (x^64)*(x^32)*(x^4)<br>
<br>
then, you can reuse an intermediate results of computation i.e:<br>
<br>
x2 := x*x.<br>
x4 := x2*x2.<br>
x8 := x4*x4.<br>
x16 := x8*x8.<br>
x32 := x16*x16.<br>
x64 := x32*x32.<br>
<br>
result := x64*x32*x4.<br>
<br>
so, totally 8 multiplications, instead of 100.<br>
<br>
&gt;<br>
&gt; sigh...<br>
&gt;<br>
&gt;<br>
&gt; So an arbitrary precision Mandelbrot generator in Squeak isn&#39;t going to be a<br>
&gt; cakewalk, apparently, or perhaps I&#39;m missing something else obvious.<br>
&gt;<br>
&gt;<br>
&gt; Lawson<br>
<div><div></div><div class="h5">&gt;<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Enrico Spinielli<br>&quot;Do Androids dream of electric sheep?&quot;— Philip K. Dick<br>&quot;Hear and forget; see and remember;do and understand.&quot;—Mitchel Resnick<br>

</div>