\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0294506023913276259:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{{1}^{3} - {\left(\cos x\right)}^{3}} \cdot \left(1 \cdot 1 + \frac{{\left(\cos x\right)}^{2} \cdot \left({\left(\cos x\right)}^{2} - 1 \cdot 1\right)}{\cos x \cdot \left(\cos x - 1\right)}\right)}}{x}\\
\mathbf{elif}\;x \le 0.031832795793103552:\\
\;\;\;\;\frac{\left(\frac{1}{2} \cdot x + \frac{1}{720} \cdot {x}^{5}\right) - \frac{1}{24} \cdot {x}^{3}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{\frac{x}{{1}^{3} - \sqrt[3]{{\left({\left(\cos x\right)}^{3}\right)}^{3}}} \cdot \left(1 \cdot 1 + \left(\cos x \cdot \cos x + 1 \cdot \cos x\right)\right)}}{x}\\
\end{array}double code(double x) {
return ((1.0 - cos(x)) / (x * x));
}
double code(double x) {
double VAR;
if ((x <= -0.029450602391327626)) {
VAR = ((1.0 / ((x / (pow(1.0, 3.0) - pow(cos(x), 3.0))) * ((1.0 * 1.0) + ((pow(cos(x), 2.0) * (pow(cos(x), 2.0) - (1.0 * 1.0))) / (cos(x) * (cos(x) - 1.0)))))) / x);
} else {
double VAR_1;
if ((x <= 0.03183279579310355)) {
VAR_1 = ((((0.5 * x) + (0.001388888888888889 * pow(x, 5.0))) - (0.041666666666666664 * pow(x, 3.0))) / x);
} else {
VAR_1 = ((1.0 / ((x / (pow(1.0, 3.0) - cbrt(pow(pow(cos(x), 3.0), 3.0)))) * ((1.0 * 1.0) + ((cos(x) * cos(x)) + (1.0 * cos(x)))))) / x);
}
VAR = VAR_1;
}
return VAR;
}



Bits error versus x
Results
if x < -0.029450602391327626Initial program 1.0
rmApplied associate-/r*0.5
rmApplied clear-num0.5
rmApplied flip3--0.5
Applied associate-/r/0.5
rmApplied flip-+0.5
Simplified0.5
Simplified0.6
if -0.029450602391327626 < x < 0.03183279579310355Initial program 62.3
rmApplied associate-/r*61.4
Taylor expanded around 0 0.0
if 0.03183279579310355 < x Initial program 1.0
rmApplied associate-/r*0.5
rmApplied clear-num0.5
rmApplied flip3--0.6
Applied associate-/r/0.6
rmApplied add-cbrt-cube0.6
Simplified0.6
Final simplification0.3
herbie shell --seed 2020106
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))