\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0301372104399350062:\\
\;\;\;\;\frac{1}{x} \cdot \frac{1 \cdot 1 - \cos x \cdot \cos x}{x \cdot \left(1 + \cos x\right)}\\
\mathbf{elif}\;x \le 0.028183382960144138:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{\mathsf{fma}\left(-{x}^{6}, \frac{1}{13824}, \frac{1}{8}\right)}{\mathsf{fma}\left(\mathsf{fma}\left({x}^{2}, \frac{1}{576}, \frac{1}{48}\right), {x}^{2}, \frac{1}{4}\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \left(\frac{1}{x} - \frac{\cos x}{x}\right)\\
\end{array}double f(double x) {
double r27597 = 1.0;
double r27598 = x;
double r27599 = cos(r27598);
double r27600 = r27597 - r27599;
double r27601 = r27598 * r27598;
double r27602 = r27600 / r27601;
return r27602;
}
double f(double x) {
double r27603 = x;
double r27604 = -0.030137210439935006;
bool r27605 = r27603 <= r27604;
double r27606 = 1.0;
double r27607 = r27606 / r27603;
double r27608 = 1.0;
double r27609 = r27608 * r27608;
double r27610 = cos(r27603);
double r27611 = r27610 * r27610;
double r27612 = r27609 - r27611;
double r27613 = r27608 + r27610;
double r27614 = r27603 * r27613;
double r27615 = r27612 / r27614;
double r27616 = r27607 * r27615;
double r27617 = 0.028183382960144138;
bool r27618 = r27603 <= r27617;
double r27619 = 4.0;
double r27620 = pow(r27603, r27619);
double r27621 = 0.001388888888888889;
double r27622 = 6.0;
double r27623 = pow(r27603, r27622);
double r27624 = -r27623;
double r27625 = 7.233796296296296e-05;
double r27626 = 0.125;
double r27627 = fma(r27624, r27625, r27626);
double r27628 = 2.0;
double r27629 = pow(r27603, r27628);
double r27630 = 0.001736111111111111;
double r27631 = 0.020833333333333332;
double r27632 = fma(r27629, r27630, r27631);
double r27633 = 0.25;
double r27634 = fma(r27632, r27629, r27633);
double r27635 = r27627 / r27634;
double r27636 = fma(r27620, r27621, r27635);
double r27637 = r27608 / r27603;
double r27638 = r27610 / r27603;
double r27639 = r27637 - r27638;
double r27640 = r27607 * r27639;
double r27641 = r27618 ? r27636 : r27640;
double r27642 = r27605 ? r27616 : r27641;
return r27642;
}



Bits error versus x
if x < -0.030137210439935006Initial program 1.1
rmApplied *-un-lft-identity1.1
Applied times-frac0.5
rmApplied flip--0.7
Applied associate-/l/0.7
if -0.030137210439935006 < x < 0.028183382960144138Initial program 62.3
Taylor expanded around 0 0.0
Simplified0.0
rmApplied flip3--0.0
Simplified0.0
Simplified0.0
if 0.028183382960144138 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
rmApplied div-sub0.7
Final simplification0.4
herbie shell --seed 2020039 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))