\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03305631426271166128927347926946822553873:\\
\;\;\;\;\frac{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right) \cdot x}}{x}\\
\mathbf{elif}\;x \le 0.03330291426620153594218010084659908898175:\\
\;\;\;\;\frac{\mathsf{fma}\left(0.001388888888888870076776527184847509488463, {x}^{5}, x \cdot 0.5\right) - {x}^{3} \cdot 0.04166666666666668517038374375260900706053}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(1 - \cos x\right)}}{x \cdot x}\\
\end{array}double f(double x) {
double r24137 = 1.0;
double r24138 = x;
double r24139 = cos(r24138);
double r24140 = r24137 - r24139;
double r24141 = r24138 * r24138;
double r24142 = r24140 / r24141;
return r24142;
}
double f(double x) {
double r24143 = x;
double r24144 = -0.03305631426271166;
bool r24145 = r24143 <= r24144;
double r24146 = 1.0;
double r24147 = 3.0;
double r24148 = pow(r24146, r24147);
double r24149 = cos(r24143);
double r24150 = pow(r24149, r24147);
double r24151 = r24148 - r24150;
double r24152 = r24146 + r24149;
double r24153 = r24146 * r24146;
double r24154 = fma(r24149, r24152, r24153);
double r24155 = r24154 * r24143;
double r24156 = r24151 / r24155;
double r24157 = r24156 / r24143;
double r24158 = 0.033302914266201536;
bool r24159 = r24143 <= r24158;
double r24160 = 0.00138888888888887;
double r24161 = 5.0;
double r24162 = pow(r24143, r24161);
double r24163 = 0.5;
double r24164 = r24143 * r24163;
double r24165 = fma(r24160, r24162, r24164);
double r24166 = pow(r24143, r24147);
double r24167 = 0.041666666666666685;
double r24168 = r24166 * r24167;
double r24169 = r24165 - r24168;
double r24170 = r24169 / r24143;
double r24171 = r24146 - r24149;
double r24172 = log(r24171);
double r24173 = exp(r24172);
double r24174 = r24143 * r24143;
double r24175 = r24173 / r24174;
double r24176 = r24159 ? r24170 : r24175;
double r24177 = r24145 ? r24157 : r24176;
return r24177;
}



Bits error versus x
if x < -0.03305631426271166Initial program 1.3
rmApplied associate-/r*0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
if -0.03305631426271166 < x < 0.033302914266201536Initial program 62.3
rmApplied associate-/r*61.3
rmApplied flip3--61.3
Applied associate-/l/61.3
Simplified61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.033302914266201536 < x Initial program 1.1
rmApplied add-exp-log1.1
Final simplification0.4
herbie shell --seed 2019174 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))