\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.02739833596085251843366137336488463915884:\\
\;\;\;\;\frac{\frac{\frac{{1}^{3} - \sqrt[3]{{\left({\left(\cos x\right)}^{3}\right)}^{3}}}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}{x}}{x}\\
\mathbf{elif}\;x \le 0.03037211695605043088042052090713696088642:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}{x}}{x}\\
\end{array}double f(double x) {
double r20507 = 1.0;
double r20508 = x;
double r20509 = cos(r20508);
double r20510 = r20507 - r20509;
double r20511 = r20508 * r20508;
double r20512 = r20510 / r20511;
return r20512;
}
double f(double x) {
double r20513 = x;
double r20514 = -0.02739833596085252;
bool r20515 = r20513 <= r20514;
double r20516 = 1.0;
double r20517 = 3.0;
double r20518 = pow(r20516, r20517);
double r20519 = cos(r20513);
double r20520 = pow(r20519, r20517);
double r20521 = pow(r20520, r20517);
double r20522 = cbrt(r20521);
double r20523 = r20518 - r20522;
double r20524 = r20519 + r20516;
double r20525 = r20519 * r20524;
double r20526 = r20516 * r20516;
double r20527 = r20525 + r20526;
double r20528 = r20523 / r20527;
double r20529 = r20528 / r20513;
double r20530 = r20529 / r20513;
double r20531 = 0.03037211695605043;
bool r20532 = r20513 <= r20531;
double r20533 = 0.001388888888888889;
double r20534 = 4.0;
double r20535 = pow(r20513, r20534);
double r20536 = r20533 * r20535;
double r20537 = 0.5;
double r20538 = r20536 + r20537;
double r20539 = 0.041666666666666664;
double r20540 = 2.0;
double r20541 = pow(r20513, r20540);
double r20542 = r20539 * r20541;
double r20543 = r20538 - r20542;
double r20544 = r20518 - r20520;
double r20545 = exp(r20544);
double r20546 = log(r20545);
double r20547 = r20546 / r20527;
double r20548 = r20547 / r20513;
double r20549 = r20548 / r20513;
double r20550 = r20532 ? r20543 : r20549;
double r20551 = r20515 ? r20530 : r20550;
return r20551;
}



Bits error versus x
Results
if x < -0.02739833596085252Initial program 1.0
rmApplied associate-/r*0.4
rmApplied flip3--0.5
Simplified0.5
rmApplied add-cbrt-cube0.5
Simplified0.5
if -0.02739833596085252 < x < 0.03037211695605043Initial program 62.1
Taylor expanded around 0 0.0
if 0.03037211695605043 < x Initial program 0.9
rmApplied associate-/r*0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.6
Simplified0.6
Final simplification0.3
herbie shell --seed 2019344
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))