\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03465278425284570168463105233058740850538 \lor \neg \left(x \le 0.03299786672642589929749235011513519566506\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{\frac{-1}{x}}{x}, \cos x, \frac{\frac{1}{x}}{x} \cdot \cos x\right) + \mathsf{fma}\left(1, \frac{\frac{1}{x}}{x}, \frac{\frac{-1}{x}}{x} \cdot \cos x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right)\right)\\
\end{array}double f(double x) {
double r53995 = 1.0;
double r53996 = x;
double r53997 = cos(r53996);
double r53998 = r53995 - r53997;
double r53999 = r53996 * r53996;
double r54000 = r53998 / r53999;
return r54000;
}
double f(double x) {
double r54001 = x;
double r54002 = -0.0346527842528457;
bool r54003 = r54001 <= r54002;
double r54004 = 0.0329978667264259;
bool r54005 = r54001 <= r54004;
double r54006 = !r54005;
bool r54007 = r54003 || r54006;
double r54008 = -1.0;
double r54009 = r54008 / r54001;
double r54010 = r54009 / r54001;
double r54011 = cos(r54001);
double r54012 = 1.0;
double r54013 = r54012 / r54001;
double r54014 = r54013 / r54001;
double r54015 = r54014 * r54011;
double r54016 = fma(r54010, r54011, r54015);
double r54017 = 1.0;
double r54018 = r54010 * r54011;
double r54019 = fma(r54017, r54014, r54018);
double r54020 = r54016 + r54019;
double r54021 = r54001 * r54001;
double r54022 = -0.041666666666666664;
double r54023 = 0.001388888888888889;
double r54024 = 4.0;
double r54025 = pow(r54001, r54024);
double r54026 = 0.5;
double r54027 = fma(r54023, r54025, r54026);
double r54028 = fma(r54021, r54022, r54027);
double r54029 = r54007 ? r54020 : r54028;
return r54029;
}



Bits error versus x
if x < -0.0346527842528457 or 0.0329978667264259 < x Initial program 1.0
rmApplied div-sub1.1
Simplified1.1
Simplified0.6
rmApplied *-un-lft-identity0.6
Applied div-inv0.6
Applied times-frac0.5
Applied *-un-lft-identity0.5
Applied div-inv0.5
Applied times-frac0.5
Applied prod-diff0.5
Simplified0.5
Simplified0.5
if -0.0346527842528457 < x < 0.0329978667264259Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.2
herbie shell --seed 2019194 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))