\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.033320062920463786:\\
\;\;\;\;\frac{\frac{{1}^{3} - \mathsf{expm1}\left(\mathsf{log1p}\left({\left(\cos x\right)}^{3}\right)\right)}{x}}{\mathsf{fma}\left(1, x \cdot 1, \left(x \cdot \cos x\right) \cdot \left(1 + \cos x\right)\right)}\\
\mathbf{elif}\;x \le 0.0329960873997033124:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \frac{1}{24} \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left(1 - \cos x\right)}}{x \cdot x}\\
\end{array}double f(double x) {
double r35764 = 1.0;
double r35765 = x;
double r35766 = cos(r35765);
double r35767 = r35764 - r35766;
double r35768 = r35765 * r35765;
double r35769 = r35767 / r35768;
return r35769;
}
double f(double x) {
double r35770 = x;
double r35771 = -0.033320062920463786;
bool r35772 = r35770 <= r35771;
double r35773 = 1.0;
double r35774 = 3.0;
double r35775 = pow(r35773, r35774);
double r35776 = cos(r35770);
double r35777 = pow(r35776, r35774);
double r35778 = log1p(r35777);
double r35779 = expm1(r35778);
double r35780 = r35775 - r35779;
double r35781 = r35780 / r35770;
double r35782 = r35770 * r35773;
double r35783 = r35770 * r35776;
double r35784 = r35773 + r35776;
double r35785 = r35783 * r35784;
double r35786 = fma(r35773, r35782, r35785);
double r35787 = r35781 / r35786;
double r35788 = 0.03299608739970331;
bool r35789 = r35770 <= r35788;
double r35790 = 4.0;
double r35791 = pow(r35770, r35790);
double r35792 = 0.001388888888888889;
double r35793 = 0.5;
double r35794 = 0.041666666666666664;
double r35795 = 2.0;
double r35796 = pow(r35770, r35795);
double r35797 = r35794 * r35796;
double r35798 = r35793 - r35797;
double r35799 = fma(r35791, r35792, r35798);
double r35800 = r35773 - r35776;
double r35801 = log(r35800);
double r35802 = exp(r35801);
double r35803 = r35770 * r35770;
double r35804 = r35802 / r35803;
double r35805 = r35789 ? r35799 : r35804;
double r35806 = r35772 ? r35787 : r35805;
return r35806;
}



Bits error versus x
if x < -0.033320062920463786Initial program 1.1
rmApplied *-un-lft-identity1.1
Applied times-frac0.5
rmApplied div-inv0.6
rmApplied flip3--0.6
Applied associate-*l/0.6
Applied frac-times0.6
Simplified0.5
Simplified0.5
rmApplied expm1-log1p-u0.5
if -0.033320062920463786 < x < 0.03299608739970331Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
if 0.03299608739970331 < x Initial program 1.0
rmApplied add-exp-log1.0
Final simplification0.4
herbie shell --seed 2020049 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))