\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03084679120220890427561677427092945436016:\\
\;\;\;\;\frac{\sqrt{1 - \cos x}}{\frac{x}{\frac{\sqrt{1 - \cos x}}{x}}}\\
\mathbf{elif}\;x \le 0.03981852127604897095825009500913438387215:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x} - \frac{\cos x}{x}}{x}\\
\end{array}double f(double x) {
double r20254 = 1.0;
double r20255 = x;
double r20256 = cos(r20255);
double r20257 = r20254 - r20256;
double r20258 = r20255 * r20255;
double r20259 = r20257 / r20258;
return r20259;
}
double f(double x) {
double r20260 = x;
double r20261 = -0.030846791202208904;
bool r20262 = r20260 <= r20261;
double r20263 = 1.0;
double r20264 = cos(r20260);
double r20265 = r20263 - r20264;
double r20266 = sqrt(r20265);
double r20267 = r20266 / r20260;
double r20268 = r20260 / r20267;
double r20269 = r20266 / r20268;
double r20270 = 0.03981852127604897;
bool r20271 = r20260 <= r20270;
double r20272 = r20260 * r20260;
double r20273 = -0.041666666666666664;
double r20274 = 0.001388888888888889;
double r20275 = 4.0;
double r20276 = pow(r20260, r20275);
double r20277 = 0.5;
double r20278 = fma(r20274, r20276, r20277);
double r20279 = fma(r20272, r20273, r20278);
double r20280 = r20263 / r20260;
double r20281 = r20264 / r20260;
double r20282 = r20280 - r20281;
double r20283 = r20282 / r20260;
double r20284 = r20271 ? r20279 : r20283;
double r20285 = r20262 ? r20269 : r20284;
return r20285;
}



Bits error versus x
if x < -0.030846791202208904Initial program 0.9
rmApplied associate-/r*0.5
rmApplied *-un-lft-identity0.5
Applied add-sqr-sqrt0.6
Applied times-frac0.6
Applied associate-/l*1.1
if -0.030846791202208904 < x < 0.03981852127604897Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
if 0.03981852127604897 < x Initial program 1.1
rmApplied associate-/r*0.4
rmApplied div-sub0.5
Final simplification0.4
herbie shell --seed 2019323 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))