\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03115379972147733905751820771001803223044:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{elif}\;x \le 0.02739005695178562543867784029316680971533:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{24}, x \cdot x, \mathsf{fma}\left(\left(x \cdot x\right) \cdot \frac{1}{720}, x \cdot x, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\end{array}double f(double x) {
double r857002 = 1.0;
double r857003 = x;
double r857004 = cos(r857003);
double r857005 = r857002 - r857004;
double r857006 = r857003 * r857003;
double r857007 = r857005 / r857006;
return r857007;
}
double f(double x) {
double r857008 = x;
double r857009 = -0.03115379972147734;
bool r857010 = r857008 <= r857009;
double r857011 = 1.0;
double r857012 = cos(r857008);
double r857013 = r857011 - r857012;
double r857014 = r857013 / r857008;
double r857015 = r857014 / r857008;
double r857016 = 0.027390056951785625;
bool r857017 = r857008 <= r857016;
double r857018 = -0.041666666666666664;
double r857019 = r857008 * r857008;
double r857020 = 0.001388888888888889;
double r857021 = r857019 * r857020;
double r857022 = 0.5;
double r857023 = fma(r857021, r857019, r857022);
double r857024 = fma(r857018, r857019, r857023);
double r857025 = r857017 ? r857024 : r857015;
double r857026 = r857010 ? r857015 : r857025;
return r857026;
}



Bits error versus x
if x < -0.03115379972147734 or 0.027390056951785625 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
rmApplied associate-*r/0.5
Simplified0.5
if -0.03115379972147734 < x < 0.027390056951785625Initial program 62.4
rmApplied *-un-lft-identity62.4
Applied times-frac61.5
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019172 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))