\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \leq -0.035212767529547204 \lor \neg \left(x \leq 0.03047569278769371\right):\\
\;\;\;\;\left(\frac{1}{x} - \frac{\cos x}{x}\right) \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;{x}^{4} \cdot 0.001388888888888889 + \left(0.5 + x \cdot \left(x \cdot -0.041666666666666664\right)\right)\\
\end{array}double code(double x) {
return (((double) (1.0 - ((double) cos(x)))) / ((double) (x * x)));
}
double code(double x) {
double VAR;
if (((x <= -0.035212767529547204) || !(x <= 0.03047569278769371))) {
VAR = ((double) (((double) ((1.0 / x) - (((double) cos(x)) / x))) * (1.0 / x)));
} else {
VAR = ((double) (((double) (((double) pow(x, 4.0)) * 0.001388888888888889)) + ((double) (0.5 + ((double) (x * ((double) (x * -0.041666666666666664))))))));
}
return VAR;
}



Bits error versus x
Results
if x < -0.035212767529547204 or 0.030475692787693711 < x Initial program 1.1
rmApplied associate-/r*0.5
rmApplied div-sub0.6
rmApplied div-inv0.7
if -0.035212767529547204 < x < 0.030475692787693711Initial program 62.3
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2020196
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))