Write a procedure to compute $f(x) = \sin(x) + \cos(x) - 1$
The routine should produce nearly full machine precision for all $x$ in the interval $[0, \frac{\pi}{4}]$
Hint: $\sin^2 \theta = \frac{1}{2} (1-\cos2\theta)$
I don't really understand why we need to do any kind of substitution to avoid uncertainty. There might be some values on the interval $[0, \pi/4]$ that make $\sin x + \cos x$ be approximately equal to $1$?
Any kind of help would be appreciated.