\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03116229552204852:\\
\;\;\;\;\frac{\frac{\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)}{\left(\cos x \cdot \left(\left(\sqrt[3]{\cos x + 1} \cdot \sqrt[3]{\cos x + 1}\right) \cdot \sqrt[3]{\cos x + 1}\right) + 1 \cdot 1\right) \cdot x}}{x}\\
\mathbf{elif}\;x \le 0.032272014734577137:\\
\;\;\;\;\frac{\left(0.5 \cdot x + 0.00138888888888887 \cdot {x}^{5}\right) - 0.041666666666666685 \cdot {x}^{3}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{1}^{3} \cdot {1}^{3} - {\left(\cos x\right)}^{3} \cdot {\left(\cos x\right)}^{3}}{\left(\left(\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1\right) \cdot x\right) \cdot \left({1}^{3} + {\left(\cos x\right)}^{3}\right)}}{x}\\
\end{array}double f(double x) {
double r25276 = 1.0;
double r25277 = x;
double r25278 = cos(r25277);
double r25279 = r25276 - r25278;
double r25280 = r25277 * r25277;
double r25281 = r25279 / r25280;
return r25281;
}
double f(double x) {
double r25282 = x;
double r25283 = -0.031162295522048522;
bool r25284 = r25282 <= r25283;
double r25285 = 1.0;
double r25286 = 3.0;
double r25287 = pow(r25285, r25286);
double r25288 = cos(r25282);
double r25289 = pow(r25288, r25286);
double r25290 = r25287 - r25289;
double r25291 = exp(r25290);
double r25292 = log(r25291);
double r25293 = r25288 + r25285;
double r25294 = cbrt(r25293);
double r25295 = r25294 * r25294;
double r25296 = r25295 * r25294;
double r25297 = r25288 * r25296;
double r25298 = r25285 * r25285;
double r25299 = r25297 + r25298;
double r25300 = r25299 * r25282;
double r25301 = r25292 / r25300;
double r25302 = r25301 / r25282;
double r25303 = 0.03227201473457714;
bool r25304 = r25282 <= r25303;
double r25305 = 0.5;
double r25306 = r25305 * r25282;
double r25307 = 0.00138888888888887;
double r25308 = 5.0;
double r25309 = pow(r25282, r25308);
double r25310 = r25307 * r25309;
double r25311 = r25306 + r25310;
double r25312 = 0.041666666666666685;
double r25313 = pow(r25282, r25286);
double r25314 = r25312 * r25313;
double r25315 = r25311 - r25314;
double r25316 = r25315 / r25282;
double r25317 = r25287 * r25287;
double r25318 = r25289 * r25289;
double r25319 = r25317 - r25318;
double r25320 = r25288 * r25293;
double r25321 = r25320 + r25298;
double r25322 = r25321 * r25282;
double r25323 = r25287 + r25289;
double r25324 = r25322 * r25323;
double r25325 = r25319 / r25324;
double r25326 = r25325 / r25282;
double r25327 = r25304 ? r25316 : r25326;
double r25328 = r25284 ? r25302 : r25327;
return r25328;
}



Bits error versus x
Results
if x < -0.031162295522048522Initial program 1.1
rmApplied associate-/r*0.4
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied add-log-exp0.5
Applied add-log-exp0.5
Applied diff-log0.6
Simplified0.5
rmApplied add-cube-cbrt0.6
if -0.031162295522048522 < x < 0.03227201473457714Initial program 62.2
rmApplied associate-/r*61.3
rmApplied flip3--61.3
Applied associate-/l/61.3
Simplified61.3
Taylor expanded around 0 0.0
if 0.03227201473457714 < x Initial program 1.3
rmApplied associate-/r*0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied flip--0.6
Applied associate-/l/0.6
Final simplification0.3
herbie shell --seed 2020025
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))