\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(\frac{1}{2} \cdot x + \frac{1}{720} \cdot {x}^{5}\right) - \frac{1}{24} \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 r143 = 1.0;
double r144 = x;
double r145 = cos(r144);
double r146 = r143 - r145;
double r147 = r144 * r144;
double r148 = r146 / r147;
return r148;
}
double f(double x) {
double r149 = x;
double r150 = -0.031162295522048522;
bool r151 = r149 <= r150;
double r152 = 1.0;
double r153 = 3.0;
double r154 = pow(r152, r153);
double r155 = cos(r149);
double r156 = pow(r155, r153);
double r157 = r154 - r156;
double r158 = exp(r157);
double r159 = log(r158);
double r160 = r155 + r152;
double r161 = cbrt(r160);
double r162 = r161 * r161;
double r163 = r162 * r161;
double r164 = r155 * r163;
double r165 = r152 * r152;
double r166 = r164 + r165;
double r167 = r166 * r149;
double r168 = r159 / r167;
double r169 = r168 / r149;
double r170 = 0.03227201473457714;
bool r171 = r149 <= r170;
double r172 = 0.5;
double r173 = r172 * r149;
double r174 = 0.001388888888888889;
double r175 = 5.0;
double r176 = pow(r149, r175);
double r177 = r174 * r176;
double r178 = r173 + r177;
double r179 = 0.041666666666666664;
double r180 = pow(r149, r153);
double r181 = r179 * r180;
double r182 = r178 - r181;
double r183 = r182 / r149;
double r184 = r154 * r154;
double r185 = r156 * r156;
double r186 = r184 - r185;
double r187 = r155 * r160;
double r188 = r187 + r165;
double r189 = r188 * r149;
double r190 = r154 + r156;
double r191 = r189 * r190;
double r192 = r186 / r191;
double r193 = r192 / r149;
double r194 = r171 ? r183 : r193;
double r195 = r151 ? r169 : r194;
return r195;
}



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
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)))