Explain why calculating values of $1 - \cos(x)$ where $x$ near zero using the trigonometric identity $1 - \cos(x) = 2\sin^2\big(\frac{x}{2}\big)$ will result in more accurate results.
Is it because when we calculate $1 - \cos(x)$ for $x$ values near zero results in subtracting two nearly equal numbers and so we loose significant digits, but when we calculate $1-\cos(x)$ using the trigonometric identity $1-\cos(x)=2\sin^2\big(\frac{x}{2}\big)$ we do not subtract two nearly exact numbers?
Why using the identity will be more accurate?
We multiply two near zero numbers and so we will loose in this case significant digits too.
Thanks for any help.