\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \leq -0.03510726007850325:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{{1}^{3} - \sqrt[3]{{\left({\left(\cos x\right)}^{3}\right)}^{3}}}{1 \cdot 1 + \cos x \cdot \left(1 + \cos x\right)}}{x}\\
\mathbf{elif}\;x \leq 0.03609453174808888:\\
\;\;\;\;{x}^{4} \cdot 0.001388888888888889 + \left(0.5 - \left(x \cdot x\right) \cdot 0.041666666666666664\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\left(1 \cdot 1 + \cos x \cdot \left(1 + \cos x\right)\right) \cdot \left(x \cdot x\right)}\\
\end{array}(FPCore (x) :precision binary64 (/ (- 1.0 (cos x)) (* x x)))
(FPCore (x)
:precision binary64
(if (<= x -0.03510726007850325)
(*
(/ 1.0 x)
(/
(/
(- (pow 1.0 3.0) (cbrt (pow (pow (cos x) 3.0) 3.0)))
(+ (* 1.0 1.0) (* (cos x) (+ 1.0 (cos x)))))
x))
(if (<= x 0.03609453174808888)
(+
(* (pow x 4.0) 0.001388888888888889)
(- 0.5 (* (* x x) 0.041666666666666664)))
(/
(- (pow 1.0 3.0) (pow (cos x) 3.0))
(* (+ (* 1.0 1.0) (* (cos x) (+ 1.0 (cos x)))) (* 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.03510726007850325)) {
tmp = ((double) ((1.0 / x) * ((((double) (((double) pow(1.0, 3.0)) - ((double) cbrt(((double) pow(((double) pow(((double) cos(x)), 3.0)), 3.0)))))) / ((double) (((double) (1.0 * 1.0)) + ((double) (((double) cos(x)) * ((double) (1.0 + ((double) cos(x))))))))) / x)));
} else {
double tmp_1;
if ((x <= 0.03609453174808888)) {
tmp_1 = ((double) (((double) (((double) pow(x, 4.0)) * 0.001388888888888889)) + ((double) (0.5 - ((double) (((double) (x * x)) * 0.041666666666666664))))));
} else {
tmp_1 = (((double) (((double) pow(1.0, 3.0)) - ((double) pow(((double) cos(x)), 3.0)))) / ((double) (((double) (((double) (1.0 * 1.0)) + ((double) (((double) cos(x)) * ((double) (1.0 + ((double) cos(x)))))))) * ((double) (x * x)))));
}
tmp = tmp_1;
}
return tmp;
}



Bits error versus x
Results
if x < -0.035107260078503247Initial program 1.2
rmApplied *-un-lft-identity_binary641.2
Applied times-frac_binary640.5
rmApplied flip3--_binary640.5
Simplified0.5
rmApplied add-cbrt-cube_binary640.6
Simplified0.6
if -0.035107260078503247 < x < 0.036094531748088882Initial program 62.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.036094531748088882 < x Initial program 1.0
rmApplied flip3--_binary641.1
Applied associate-/l/_binary641.2
Simplified1.2
Final simplification0.4
herbie shell --seed 2020204
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1.0 (cos x)) (* x x)))