15 ms·
You need around 26 terms for x=10 if you do it without reduction and you want an accuratish result for double precision. You wouldn't evaluate the terms naivel
by planede 3y ago
You need around 26 terms for x=10 if you do it without reduction and you want an accuratish result for double precision.
You wouldn't evaluate the terms naively from left-to-right.
x - x^3/3! + x^5/5! - ... = x * (1 - x^2/(2*3) * (1 - x^2/(4*5) * ... ) )
I just checked in python and you get a result that is around 1000*machine epsilon off. Not great, not terrible.