\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0266096722673715806:\\
\;\;\;\;\frac{1}{x} \cdot \frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\left(\sqrt[3]{{\left(\cos x \cdot \left(\cos x + 1\right)\right)}^{3}} + 1 \cdot 1\right) \cdot x}\\
\mathbf{elif}\;x \le 0.0284410596258715502:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)}{\left(\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1\right) \cdot x}\\
\end{array}double f(double x) {
double r17089 = 1.0;
double r17090 = x;
double r17091 = cos(r17090);
double r17092 = r17089 - r17091;
double r17093 = r17090 * r17090;
double r17094 = r17092 / r17093;
return r17094;
}
double f(double x) {
double r17095 = x;
double r17096 = -0.02660967226737158;
bool r17097 = r17095 <= r17096;
double r17098 = 1.0;
double r17099 = r17098 / r17095;
double r17100 = 1.0;
double r17101 = 3.0;
double r17102 = pow(r17100, r17101);
double r17103 = cos(r17095);
double r17104 = pow(r17103, r17101);
double r17105 = r17102 - r17104;
double r17106 = r17103 + r17100;
double r17107 = r17103 * r17106;
double r17108 = pow(r17107, r17101);
double r17109 = cbrt(r17108);
double r17110 = r17100 * r17100;
double r17111 = r17109 + r17110;
double r17112 = r17111 * r17095;
double r17113 = r17105 / r17112;
double r17114 = r17099 * r17113;
double r17115 = 0.02844105962587155;
bool r17116 = r17095 <= r17115;
double r17117 = 0.001388888888888889;
double r17118 = 4.0;
double r17119 = pow(r17095, r17118);
double r17120 = r17117 * r17119;
double r17121 = 0.5;
double r17122 = r17120 + r17121;
double r17123 = 0.041666666666666664;
double r17124 = 2.0;
double r17125 = pow(r17095, r17124);
double r17126 = r17123 * r17125;
double r17127 = r17122 - r17126;
double r17128 = exp(r17105);
double r17129 = log(r17128);
double r17130 = r17107 + r17110;
double r17131 = r17130 * r17095;
double r17132 = r17129 / r17131;
double r17133 = r17099 * r17132;
double r17134 = r17116 ? r17127 : r17133;
double r17135 = r17097 ? r17114 : r17134;
return r17135;
}



Bits error versus x
Results
if x < -0.02660967226737158Initial program 0.9
rmApplied *-un-lft-identity0.9
Applied times-frac0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied add-cbrt-cube0.5
Applied add-cbrt-cube0.5
Applied cbrt-unprod0.5
Simplified0.5
if -0.02660967226737158 < x < 0.02844105962587155Initial program 62.2
Taylor expanded around 0 0.0
if 0.02844105962587155 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
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
Final simplification0.3
herbie shell --seed 2020046
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))