\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0340458149574629151 \lor \neg \left(x \le 0.032087851221962699\right):\\
\;\;\;\;\frac{\frac{\sqrt[3]{{\left(1 - \cos x\right)}^{3}}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\log \left(e^{\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}}\right)\\
\end{array}double code(double x) {
return ((double) (((double) (1.0 - ((double) cos(x)))) / ((double) (x * x))));
}
double code(double x) {
double VAR;
if (((x <= -0.034045814957462915) || !(x <= 0.0320878512219627))) {
VAR = ((double) (((double) (((double) cbrt(((double) pow(((double) (1.0 - ((double) cos(x)))), 3.0)))) / x)) / x));
} else {
VAR = ((double) log(((double) exp(((double) (((double) (((double) (0.001388888888888889 * ((double) pow(x, 4.0)))) + 0.5)) - ((double) (0.041666666666666664 * ((double) pow(x, 2.0))))))))));
}
return VAR;
}



Bits error versus x
Results
if x < -0.034045814957462915 or 0.0320878512219627 < x Initial program 1.1
rmApplied associate-/r*0.5
rmApplied add-cbrt-cube0.6
Simplified0.6
if -0.034045814957462915 < x < 0.0320878512219627Initial program 62.3
Taylor expanded around 0 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied add-log-exp0.0
Applied sum-log0.0
Applied diff-log0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2020120
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))