I am trying out a few forms of polynomial expression optimization, and I'd like to improve of what I've got, if anyone has anything they know is better.
Implementation 1:
$$x-\frac{x^3}{3!}+\frac{x^5}{5!}-\frac{x^7}{7!}$$
To the best of my knowledge, this has 3 add/subtracts, 21 muls, and 3 divs.
Implementation 2:
$$x(1+x^2(\frac{-1}{3!} + x^2(\frac{1}{5!} + x^2(\frac{-1}{7!}))))$$
This appears to have 3 adds/subracts, 13 muls, and 3 divs. This is assuming that $x^2$ is precalculated. (I may have counted wrong here.)
Implementation 3:
$$x(1+\frac{x^2}{3!}(-1 + \frac{x^2}{5*4}(1 - \frac{x^2}{7*6}))))$$
This appears to have 3 adds/subtracts, 6 muls, and 3 divs. Edit: Again, assuming a precalculated $x^2$.
Note: In all my factorial calculations, I have not done the $*1$ final multiply.
Am I doing anything wrong here, or is there any way this implementation can be made more computationally efficient?