4 ms·
It would also be extremely inaccurate. The x^n numerators grow very quickly and digits get lost because unlimited precision isn't available. Likewise, the n!
by zgs 3y ago
It would also be extremely inaccurate. The x^n numerators grow very quickly and digits get lost because unlimited precision isn't available. Likewise, the n! denominators also grow rapidly. Then the series is alternating which means cancellation is happening for every added term.
If you don't believe me try for x=10.
- deleted 3y ago[deleted]
- planede 3y agoYou 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.