\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03115379972147733905751820771001803223044:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{elif}\;x \le 0.02739005695178562543867784029316680971533:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{24}, x \cdot x, \mathsf{fma}\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{720}, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\end{array}double f(double x) {
double r868391 = 1.0;
double r868392 = x;
double r868393 = cos(r868392);
double r868394 = r868391 - r868393;
double r868395 = r868392 * r868392;
double r868396 = r868394 / r868395;
return r868396;
}
double f(double x) {
double r868397 = x;
double r868398 = -0.03115379972147734;
bool r868399 = r868397 <= r868398;
double r868400 = 1.0;
double r868401 = cos(r868397);
double r868402 = r868400 - r868401;
double r868403 = r868402 / r868397;
double r868404 = r868403 / r868397;
double r868405 = 0.027390056951785625;
bool r868406 = r868397 <= r868405;
double r868407 = -0.041666666666666664;
double r868408 = r868397 * r868397;
double r868409 = r868408 * r868408;
double r868410 = 0.001388888888888889;
double r868411 = 0.5;
double r868412 = fma(r868409, r868410, r868411);
double r868413 = fma(r868407, r868408, r868412);
double r868414 = r868406 ? r868413 : r868404;
double r868415 = r868399 ? r868404 : r868414;
return r868415;
}



Bits error versus x
if x < -0.03115379972147734 or 0.027390056951785625 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
rmApplied associate-*r/0.5
Simplified0.5
if -0.03115379972147734 < x < 0.027390056951785625Initial program 62.4
rmApplied *-un-lft-identity62.4
Applied times-frac61.5
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019172 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))