\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0309273812351459031 \lor \neg \left(x \le 0.023960596481684263\right):\\
\;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{1 - \cos x}{{x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \frac{1}{24} \cdot {x}^{2}\right)\\
\end{array}double f(double x) {
double r27544 = 1.0;
double r27545 = x;
double r27546 = cos(r27545);
double r27547 = r27544 - r27546;
double r27548 = r27545 * r27545;
double r27549 = r27547 / r27548;
return r27549;
}
double f(double x) {
double r27550 = x;
double r27551 = -0.030927381235145903;
bool r27552 = r27550 <= r27551;
double r27553 = 0.023960596481684263;
bool r27554 = r27550 <= r27553;
double r27555 = !r27554;
bool r27556 = r27552 || r27555;
double r27557 = 1.0;
double r27558 = sqrt(r27557);
double r27559 = r27558 / r27557;
double r27560 = 1.0;
double r27561 = cos(r27550);
double r27562 = r27560 - r27561;
double r27563 = 2.0;
double r27564 = pow(r27550, r27563);
double r27565 = r27562 / r27564;
double r27566 = r27559 * r27565;
double r27567 = 4.0;
double r27568 = pow(r27550, r27567);
double r27569 = 0.001388888888888889;
double r27570 = 0.5;
double r27571 = 0.041666666666666664;
double r27572 = r27571 * r27564;
double r27573 = r27570 - r27572;
double r27574 = fma(r27568, r27569, r27573);
double r27575 = r27556 ? r27566 : r27574;
return r27575;
}



Bits error versus x
if x < -0.030927381235145903 or 0.023960596481684263 < x Initial program 1.1
rmApplied add-sqr-sqrt1.2
Applied times-frac0.6
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.7
Simplified0.6
rmApplied *-un-lft-identity0.6
Applied pow10.6
Applied log-pow0.6
Applied sqrt-prod0.6
Applied times-frac0.6
Applied associate-*l*0.6
Simplified1.1
if -0.030927381235145903 < x < 0.023960596481684263Initial program 62.4
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.6
herbie shell --seed 2020060 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))