On Sunday, February 22, 2015 at 10:06:44 AM UTC-5, DumpsterDoofus wrote:
>
> Nope, I was just manually typing them in, but thanks for pointing that 
> out. I tried it by calling `import Base.Math.@horner` and then implemented 
> it like this:
> f = @horner(x, a0, a1, a2, a3, a4)
> fP = @horner(x, a1, 2*a2, 3*a3, 4*a4)
> fPP = @horner(x, 2*a2, 6*a3, 12*a4)
> Performance was the same as manually entering the Horner forms by hand 
> (ie, much better than the non-Horner form). Good to know!
>

Better to just use @evalpoly(x, a0, a1, ...).   This has the advantage of 
being documented and exported already.    It inlines to @horner for real x 
and to a different algorithm for complex x (where you can do better than 
horner).

Reply via email to