Hello.

Kell, now what you have written is supposedly what is going on behind the scenes, in applescript, we can write the polynomial fully out, in one go, which I think you can’t at all times. That is at least how I relearned it from a book, as I also thought that your variant of it, is the way to do it, but heck, you can just have the coeffecients for the terms in the code, as variables, and if necessary calculate them up front.

(I timed the scheme I posted above, and it seemed faster than multiplying all of the terms out, for 1000 iterations, for figures over 1000, then spelling out the expression “normally” seemed faster.

I don’t see me iterate more than say 100 times, so for me Horners rule is good.

I also agree about the powers of, when the exponents are real, which they often are!

I think you can or should be able to optimize such a calculation a little bit further, by factoring the power function (^) into exp and ln statements, so that you only raise the logarithm by the exponent in the final step, for the last result.

It should save some, if it is needed.

Edit

It is really odd that the link doesn’t work, because it works from Google, without being cached, it is the page from rosettacode.org.