\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \leq -0.02933386181963808:\\
\;\;\;\;\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{x \cdot \left(x \cdot \left(1 \cdot 1 + \cos x \cdot \left(1 + \cos x\right)\right)\right)}\\
\mathbf{elif}\;x \leq 0.03400527114210335:\\
\;\;\;\;{x}^{4} \cdot 0.001388888888888889 + \left(0.5 + x \cdot \left(x \cdot -0.041666666666666664\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{1 - \cos x}}{x} \cdot \left(\sqrt[3]{1 - \cos x} \cdot \frac{\sqrt[3]{1 - \cos x}}{x}\right)\\
\end{array}(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
(FPCore (x)
:precision binary64
(if (<= x -0.02933386181963808)
(/
(- (pow 1.0 3.0) (pow (cos x) 3.0))
(* x (* x (+ (* 1.0 1.0) (* (cos x) (+ 1.0 (cos x)))))))
(if (<= x 0.03400527114210335)
(+
(* (pow x 4.0) 0.001388888888888889)
(+ 0.5 (* x (* x -0.041666666666666664))))
(*
(/ (cbrt (- 1.0 (cos x))) x)
(* (cbrt (- 1.0 (cos x))) (/ (cbrt (- 1.0 (cos x))) x))))))double code(double x) {
return (((double) (1.0 - ((double) cos(x)))) / ((double) (x * x)));
}
double code(double x) {
double tmp;
if ((x <= -0.02933386181963808)) {
tmp = (((double) (((double) pow(1.0, 3.0)) - ((double) pow(((double) cos(x)), 3.0)))) / ((double) (x * ((double) (x * ((double) (((double) (1.0 * 1.0)) + ((double) (((double) cos(x)) * ((double) (1.0 + ((double) cos(x)))))))))))));
} else {
double tmp_1;
if ((x <= 0.03400527114210335)) {
tmp_1 = ((double) (((double) (((double) pow(x, 4.0)) * 0.001388888888888889)) + ((double) (0.5 + ((double) (x * ((double) (x * -0.041666666666666664))))))));
} else {
tmp_1 = ((double) ((((double) cbrt(((double) (1.0 - ((double) cos(x)))))) / x) * ((double) (((double) cbrt(((double) (1.0 - ((double) cos(x)))))) * (((double) cbrt(((double) (1.0 - ((double) cos(x)))))) / x)))));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus x
Results
if x < -0.0293338618196380789Initial program Error: 1.2 bits
rmApplied flip3--Error: 1.2 bits
Applied associate-/l/Error: 1.2 bits
SimplifiedError: 1.2 bits
if -0.0293338618196380789 < x < 0.034005271142103347Initial program Error: 62.3 bits
Taylor expanded around 0 Error: 0.0 bits
SimplifiedError: 0.0 bits
if 0.034005271142103347 < x Initial program Error: 1.1 bits
rmApplied add-cube-cbrtError: 1.5 bits
Applied times-fracError: 0.9 bits
SimplifiedError: 0.9 bits
Final simplificationError: 0.5 bits
herbie shell --seed 2020203
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))