Learning Scientific Programming with Python (2nd edition)

Q10.1.4: Floating point approximations to two trigonometric functions

Question Q10.1.4

The functions $f(x) = (1-\cos^2x)/x^2$ and $g(x) = \sin^2x / x^2$ are mathematically identical, but plotted in the region $-0.001 \le x \le 0.001$ show a significant difference. Explain the origin of this difference.