\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(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right) - \left(x \cdot x\right) \cdot \frac{1}{24}\\
\end{array}double f(double x) {
double r61859 = 1.0;
double r61860 = x;
double r61861 = cos(r61860);
double r61862 = r61859 - r61861;
double r61863 = r61860 * r61860;
double r61864 = r61862 / r61863;
return r61864;
}
double f(double x) {
double r61865 = x;
double r61866 = -0.0346527842528457;
bool r61867 = r61865 <= r61866;
double r61868 = 0.0329978667264259;
bool r61869 = r61865 <= r61868;
double r61870 = !r61869;
bool r61871 = r61867 || r61870;
double r61872 = -1.0;
double r61873 = r61872 / r61865;
double r61874 = r61873 / r61865;
double r61875 = cos(r61865);
double r61876 = 1.0;
double r61877 = r61876 / r61865;
double r61878 = r61877 / r61865;
double r61879 = r61878 * r61875;
double r61880 = fma(r61874, r61875, r61879);
double r61881 = 1.0;
double r61882 = r61881 / r61865;
double r61883 = r61882 / r61865;
double r61884 = r61874 * r61875;
double r61885 = fma(r61876, r61883, r61884);
double r61886 = r61880 + r61885;
double r61887 = 0.001388888888888889;
double r61888 = 4.0;
double r61889 = pow(r61865, r61888);
double r61890 = 0.5;
double r61891 = fma(r61887, r61889, r61890);
double r61892 = r61865 * r61865;
double r61893 = 0.041666666666666664;
double r61894 = r61892 * r61893;
double r61895 = r61891 - r61894;
double r61896 = r61871 ? r61886 : r61895;
return r61896;
}



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 *-un-lft-identity0.5
Applied *-un-lft-identity0.5
Applied times-frac0.5
Applied times-frac0.5
Applied prod-diff0.5
Simplified0.5
Simplified0.5
if -0.0346527842528457 < x < 0.0329978667264259Initial program 62.2
rmApplied div-sub62.0
Simplified62.1
Simplified62.1
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)))