\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.034342488507809403:\\
\;\;\;\;\frac{\frac{1 - \cos x}{x}}{x}\\
\mathbf{elif}\;x \le 0.033493863120598724:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 0.5, 0.00138888888888887 \cdot {x}^{5} - 0.041666666666666685 \cdot {x}^{3}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{{1}^{3}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(\cos x, \cos x, 1 \cdot \cos x\right)\right) \cdot x} - \frac{\frac{{\left(\cos x\right)}^{3}}{\mathsf{fma}\left(1, 1, \mathsf{fma}\left(\cos x, \cos x, 1 \cdot \cos x\right)\right)}}{x}}{x}\\
\end{array}double f(double x) {
double r41649 = 1.0;
double r41650 = x;
double r41651 = cos(r41650);
double r41652 = r41649 - r41651;
double r41653 = r41650 * r41650;
double r41654 = r41652 / r41653;
return r41654;
}
double f(double x) {
double r41655 = x;
double r41656 = -0.0343424885078094;
bool r41657 = r41655 <= r41656;
double r41658 = 1.0;
double r41659 = cos(r41655);
double r41660 = r41658 - r41659;
double r41661 = r41660 / r41655;
double r41662 = r41661 / r41655;
double r41663 = 0.033493863120598724;
bool r41664 = r41655 <= r41663;
double r41665 = 0.5;
double r41666 = 0.00138888888888887;
double r41667 = 5.0;
double r41668 = pow(r41655, r41667);
double r41669 = r41666 * r41668;
double r41670 = 0.041666666666666685;
double r41671 = 3.0;
double r41672 = pow(r41655, r41671);
double r41673 = r41670 * r41672;
double r41674 = r41669 - r41673;
double r41675 = fma(r41655, r41665, r41674);
double r41676 = r41675 / r41655;
double r41677 = pow(r41658, r41671);
double r41678 = r41658 * r41659;
double r41679 = fma(r41659, r41659, r41678);
double r41680 = fma(r41658, r41658, r41679);
double r41681 = r41680 * r41655;
double r41682 = r41677 / r41681;
double r41683 = pow(r41659, r41671);
double r41684 = r41683 / r41680;
double r41685 = r41684 / r41655;
double r41686 = r41682 - r41685;
double r41687 = r41686 / r41655;
double r41688 = r41664 ? r41676 : r41687;
double r41689 = r41657 ? r41662 : r41688;
return r41689;
}



Bits error versus x
if x < -0.0343424885078094Initial program 1.1
rmApplied associate-/r*0.4
if -0.0343424885078094 < x < 0.033493863120598724Initial program 62.2
rmApplied associate-/r*61.3
rmApplied flip3--61.3
Applied associate-/l/61.3
Simplified61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.033493863120598724 < x Initial program 1.3
rmApplied associate-/r*0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied expm1-log1p-u0.6
rmApplied div-sub0.6
Simplified0.5
Final simplification0.3
herbie shell --seed 2020025 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))