Loss of numerical precision

Suppose we wish to evaluate the function $$ f(x)=\frac{1-\cos(x)}{\sin(x)}, $$ for small values of \( x \). Five leading digits. If we multiply the denominator and numerator with \( 1+\cos(x) \) we obtain the equivalent expression $$ f(x)=\frac{\sin(x)}{1+\cos(x)}. $$

If we now choose \( x=0.007 \) (in radians) our choice of precision results in $$ \sin(0.007)\approx 0.69999\times 10^{-2}, $$ and $$ \cos(0.007)\approx 0.99998. $$