\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0286652458901892858:\\
\;\;\;\;\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{{x}^{2} \cdot \mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right)}\\
\mathbf{elif}\;x \le 0.0328059247821943858:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \log \left(e^{\frac{1}{24} \cdot {x}^{2}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\cos x}{x}}{x}\\
\end{array}double f(double x) {
double r19632 = 1.0;
double r19633 = x;
double r19634 = cos(r19633);
double r19635 = r19632 - r19634;
double r19636 = r19633 * r19633;
double r19637 = r19635 / r19636;
return r19637;
}
double f(double x) {
double r19638 = x;
double r19639 = -0.028665245890189286;
bool r19640 = r19638 <= r19639;
double r19641 = 1.0;
double r19642 = 3.0;
double r19643 = pow(r19641, r19642);
double r19644 = cos(r19638);
double r19645 = pow(r19644, r19642);
double r19646 = r19643 - r19645;
double r19647 = 2.0;
double r19648 = pow(r19638, r19647);
double r19649 = r19641 + r19644;
double r19650 = r19641 * r19641;
double r19651 = fma(r19644, r19649, r19650);
double r19652 = r19648 * r19651;
double r19653 = r19646 / r19652;
double r19654 = 0.032805924782194386;
bool r19655 = r19638 <= r19654;
double r19656 = 4.0;
double r19657 = pow(r19638, r19656);
double r19658 = 0.001388888888888889;
double r19659 = 0.5;
double r19660 = 0.041666666666666664;
double r19661 = r19660 * r19648;
double r19662 = exp(r19661);
double r19663 = log(r19662);
double r19664 = r19659 - r19663;
double r19665 = fma(r19657, r19658, r19664);
double r19666 = r19641 / r19638;
double r19667 = r19644 / r19638;
double r19668 = r19666 - r19667;
double r19669 = r19668 / r19638;
double r19670 = r19655 ? r19665 : r19669;
double r19671 = r19640 ? r19653 : r19670;
return r19671;
}



Bits error versus x
if x < -0.028665245890189286Initial program 1.2
rmApplied flip3--1.2
Applied associate-/l/1.2
Simplified1.2
if -0.028665245890189286 < x < 0.032805924782194386Initial program 62.3
Taylor expanded around 0 0.0
Simplified0.0
rmApplied add-log-exp0.0
if 0.032805924782194386 < x Initial program 1.1
rmApplied associate-/r*0.5
rmApplied div-sub0.6
Final simplification0.4
herbie shell --seed 2020035 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))