> p := 1;
> while n <> 0 do
> begin
>      if n mod 2 = 1 then p := p * x;
>      n := n div 2;
>      x := sqr(x);
> end;

  Well, I think you made a small error here, Maarten. If you want to
calculate x^n with n being an integer, so n = {0, 1, 2, 3, ....}, then
the formula for x should be "x := x * x". I'm not sure how to calculate
x^n with 0<n<1 (so for instance x^0.25). Suggestions, anyone?

  Bye, /\/\ark

****
MSX Mailinglist. To unsubscribe, send an email to [EMAIL PROTECTED] and put
in the body (not subject) "unsubscribe msx [EMAIL PROTECTED]" (without the
quotes :-) Problems? contact [EMAIL PROTECTED] (www.stack.nl/~wiebe/mailinglist/)
****

Reply via email to