Find the relative error when storing six digits in the mantissa using rounding of $\cos^2x-\sin^2x$ where $x=0.7854$
So $f(0.7854)=-3.673205105\cdot 10^{-6}$
And $fl(0.7854)=(0.7071)^2-(0.7071)^2=0$
So the relative error is $$\frac{\mid -3.673205105\cdot 10^{-6}-0\mid}{\mid -3.673205105\cdot 10^{-6}\mid}=100\%$$
But the answer in the book is $36%$ where did I get it wrong?
You need to round all intermediate values to 6 mantissa digits, for some reason you only used 4:
For the exact result, as you said
For the first step, the trigonometric values are
Now round to 6 digits after the decimal dot and square
and compute the difference of the squares, rounded again to 6 digits
The relative error is thus
that is, the announced $36\%$.