\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0330594120648614667:\\
\;\;\;\;\frac{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}{x \cdot x}\\
\mathbf{elif}\;x \le 0.034074837610598666:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\frac{\frac{{\left(1 \cdot 1\right)}^{3} - {\left(\cos x \cdot \cos x\right)}^{3}}{\left({1}^{4} + 1 \cdot \left(1 \cdot {\left(\cos x\right)}^{2}\right)\right) + {\left(\cos x\right)}^{4}}}{1 + \cos x}}}{x} \cdot \frac{\sqrt{\log \left(e^{1 - \cos x}\right)}}{x}\\
\end{array}double code(double x) {
return ((1.0 - cos(x)) / (x * x));
}
double code(double x) {
double temp;
if ((x <= -0.03305941206486147)) {
temp = (((pow(1.0, 3.0) - pow(cos(x), 3.0)) / ((cos(x) * (cos(x) + 1.0)) + (1.0 * 1.0))) / (x * x));
} else {
double temp_1;
if ((x <= 0.034074837610598666)) {
temp_1 = (((0.001388888888888889 * pow(x, 4.0)) + 0.5) - (0.041666666666666664 * pow(x, 2.0)));
} else {
temp_1 = ((sqrt((((pow((1.0 * 1.0), 3.0) - pow((cos(x) * cos(x)), 3.0)) / ((pow(1.0, 4.0) + (1.0 * (1.0 * pow(cos(x), 2.0)))) + pow(cos(x), 4.0))) / (1.0 + cos(x)))) / x) * (sqrt(log(exp((1.0 - cos(x))))) / x));
}
temp = temp_1;
}
return temp;
}



Bits error versus x
Results
if x < -0.03305941206486147Initial program 1.0
rmApplied flip3--1.0
Simplified1.0
if -0.03305941206486147 < x < 0.034074837610598666Initial program 62.1
Taylor expanded around 0 0.0
if 0.034074837610598666 < x Initial program 1.0
rmApplied add-sqr-sqrt1.1
Applied times-frac0.5
rmApplied add-log-exp0.5
Applied add-log-exp0.5
Applied diff-log0.6
Simplified0.5
rmApplied flip--0.6
rmApplied flip3--0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020057
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))