\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0347406315074210436666390933169168420136:\\
\;\;\;\;\frac{\frac{1}{x}}{x} - \frac{\frac{\cos x}{x}}{x}\\
\mathbf{elif}\;x \le 0.03078339684086396285667142080910707591102:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{720}, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x}{\frac{1 - \cos x}{x}}}\\
\end{array}double f(double x) {
double r720203 = 1.0;
double r720204 = x;
double r720205 = cos(r720204);
double r720206 = r720203 - r720205;
double r720207 = r720204 * r720204;
double r720208 = r720206 / r720207;
return r720208;
}
double f(double x) {
double r720209 = x;
double r720210 = -0.034740631507421044;
bool r720211 = r720209 <= r720210;
double r720212 = 1.0;
double r720213 = r720212 / r720209;
double r720214 = r720213 / r720209;
double r720215 = cos(r720209);
double r720216 = r720215 / r720209;
double r720217 = r720216 / r720209;
double r720218 = r720214 - r720217;
double r720219 = 0.030783396840863963;
bool r720220 = r720209 <= r720219;
double r720221 = r720209 * r720209;
double r720222 = -0.041666666666666664;
double r720223 = r720221 * r720221;
double r720224 = 0.001388888888888889;
double r720225 = 0.5;
double r720226 = fma(r720223, r720224, r720225);
double r720227 = fma(r720221, r720222, r720226);
double r720228 = 1.0;
double r720229 = r720212 - r720215;
double r720230 = r720229 / r720209;
double r720231 = r720209 / r720230;
double r720232 = r720228 / r720231;
double r720233 = r720220 ? r720227 : r720232;
double r720234 = r720211 ? r720218 : r720233;
return r720234;
}



Bits error versus x
if x < -0.034740631507421044Initial program 1.0
rmApplied associate-/r*0.5
rmApplied div-sub0.6
Applied div-sub0.7
if -0.034740631507421044 < x < 0.030783396840863963Initial program 62.3
rmApplied associate-/r*61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.030783396840863963 < x Initial program 1.0
rmApplied associate-/r*0.5
rmApplied clear-num1.1
Final simplification0.4
herbie shell --seed 2019192 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))