\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \leq -0.03651380642110043:\\
\;\;\;\;\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}\\
\mathbf{elif}\;x \leq 0.03386786279469105:\\
\;\;\;\;{x}^{4} \cdot 0.001388888888888889 + \left(0.5 + x \cdot \left(x \cdot -0.041666666666666664\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot \frac{x}{1 - \cos x}}\\
\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.03651380642110043)) {
VAR = ((double) ((1.0 / ((double) (x * x))) - (((double) cos(x)) / ((double) (x * x)))));
} else {
double VAR_1;
if ((x <= 0.03386786279469105)) {
VAR_1 = ((double) (((double) (((double) pow(x, 4.0)) * 0.001388888888888889)) + ((double) (0.5 + ((double) (x * ((double) (x * -0.041666666666666664))))))));
} else {
VAR_1 = (1.0 / ((double) (x * (x / ((double) (1.0 - ((double) cos(x))))))));
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x
Results
if x < -0.036513806421100428Initial program Error: 1.0 bits
rmApplied div-subError: 1.1 bits
if -0.036513806421100428 < x < 0.033867862794691048Initial program Error: 62.2 bits
Taylor expanded around 0 Error: 0.0 bits
SimplifiedError: 0.0 bits
if 0.033867862794691048 < x Initial program Error: 1.2 bits
rmApplied clear-numError: 1.3 bits
SimplifiedError: 1.2 bits
Final simplificationError: 0.6 bits
herbie shell --seed 2020200
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))