\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.036038474483329114:\\
\;\;\;\;\frac{\sqrt{\log \left(e^{1 - \cos x}\right)}}{x} \cdot \frac{\sqrt{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\mathsf{fma}\left(1, 1, \cos x \cdot \left(\left(\sqrt[3]{\cos x + 1} \cdot \sqrt[3]{\cos x + 1}\right) \cdot \sqrt[3]{\cos x + 1}\right)\right)}}}{x}\\
\mathbf{elif}\;x \le 0.033100735860822239:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \frac{1}{24} \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 - \cos x\right) \cdot \frac{1}{x \cdot x}\\
\end{array}double f(double x) {
double r30163 = 1.0;
double r30164 = x;
double r30165 = cos(r30164);
double r30166 = r30163 - r30165;
double r30167 = r30164 * r30164;
double r30168 = r30166 / r30167;
return r30168;
}
double f(double x) {
double r30169 = x;
double r30170 = -0.036038474483329114;
bool r30171 = r30169 <= r30170;
double r30172 = 1.0;
double r30173 = cos(r30169);
double r30174 = r30172 - r30173;
double r30175 = exp(r30174);
double r30176 = log(r30175);
double r30177 = sqrt(r30176);
double r30178 = r30177 / r30169;
double r30179 = 3.0;
double r30180 = pow(r30172, r30179);
double r30181 = pow(r30173, r30179);
double r30182 = r30180 - r30181;
double r30183 = r30173 + r30172;
double r30184 = cbrt(r30183);
double r30185 = r30184 * r30184;
double r30186 = r30185 * r30184;
double r30187 = r30173 * r30186;
double r30188 = fma(r30172, r30172, r30187);
double r30189 = r30182 / r30188;
double r30190 = sqrt(r30189);
double r30191 = r30190 / r30169;
double r30192 = r30178 * r30191;
double r30193 = 0.03310073586082224;
bool r30194 = r30169 <= r30193;
double r30195 = 4.0;
double r30196 = pow(r30169, r30195);
double r30197 = 0.001388888888888889;
double r30198 = 0.5;
double r30199 = 0.041666666666666664;
double r30200 = 2.0;
double r30201 = pow(r30169, r30200);
double r30202 = r30199 * r30201;
double r30203 = r30198 - r30202;
double r30204 = fma(r30196, r30197, r30203);
double r30205 = 1.0;
double r30206 = r30169 * r30169;
double r30207 = r30205 / r30206;
double r30208 = r30174 * r30207;
double r30209 = r30194 ? r30204 : r30208;
double r30210 = r30171 ? r30192 : r30209;
return r30210;
}



Bits error versus x
if x < -0.036038474483329114Initial program 1.0
rmApplied add-sqr-sqrt1.1
Applied times-frac0.6
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.6
Simplified0.6
rmApplied flip3--0.6
Simplified0.6
rmApplied add-cube-cbrt0.6
if -0.036038474483329114 < x < 0.03310073586082224Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
if 0.03310073586082224 < x Initial program 1.2
rmApplied div-inv1.3
Final simplification0.5
herbie shell --seed 2020020 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))