\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.02966430694204434670435688303768984042108:\\
\;\;\;\;\frac{\sqrt{\log \left(e^{1 - \cos x}\right)} \cdot \sqrt{\sqrt{1 - \cos x}}}{x} \cdot \frac{\sqrt{\sqrt{1 - \cos x}}}{x}\\
\mathbf{elif}\;x \le 0.03656973987245589613470642120773845817894:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{24}, x \cdot x, \mathsf{fma}\left(\frac{1}{720}, \left(x \cdot x\right) \cdot \left(x \cdot x\right), \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot x} - \frac{\cos x}{x \cdot x}\\
\end{array}double f(double x) {
double r2287637 = 1.0;
double r2287638 = x;
double r2287639 = cos(r2287638);
double r2287640 = r2287637 - r2287639;
double r2287641 = r2287638 * r2287638;
double r2287642 = r2287640 / r2287641;
return r2287642;
}
double f(double x) {
double r2287643 = x;
double r2287644 = -0.029664306942044347;
bool r2287645 = r2287643 <= r2287644;
double r2287646 = 1.0;
double r2287647 = cos(r2287643);
double r2287648 = r2287646 - r2287647;
double r2287649 = exp(r2287648);
double r2287650 = log(r2287649);
double r2287651 = sqrt(r2287650);
double r2287652 = sqrt(r2287648);
double r2287653 = sqrt(r2287652);
double r2287654 = r2287651 * r2287653;
double r2287655 = r2287654 / r2287643;
double r2287656 = r2287653 / r2287643;
double r2287657 = r2287655 * r2287656;
double r2287658 = 0.036569739872455896;
bool r2287659 = r2287643 <= r2287658;
double r2287660 = -0.041666666666666664;
double r2287661 = r2287643 * r2287643;
double r2287662 = 0.001388888888888889;
double r2287663 = r2287661 * r2287661;
double r2287664 = 0.5;
double r2287665 = fma(r2287662, r2287663, r2287664);
double r2287666 = fma(r2287660, r2287661, r2287665);
double r2287667 = r2287646 / r2287661;
double r2287668 = r2287647 / r2287661;
double r2287669 = r2287667 - r2287668;
double r2287670 = r2287659 ? r2287666 : r2287669;
double r2287671 = r2287645 ? r2287657 : r2287670;
return r2287671;
}



Bits error versus x
if x < -0.029664306942044347Initial program 1.0
rmApplied add-sqr-sqrt1.1
Applied times-frac0.6
rmApplied *-un-lft-identity0.6
Applied add-sqr-sqrt0.6
Applied sqrt-prod0.7
Applied times-frac0.6
Applied associate-*r*0.6
Simplified0.6
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.7
Simplified0.6
if -0.029664306942044347 < x < 0.036569739872455896Initial program 62.2
rmApplied add-sqr-sqrt62.2
Applied times-frac61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.036569739872455896 < x Initial program 1.1
rmApplied div-sub1.2
Final simplification0.5
herbie shell --seed 2019173 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))