\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 r141 = 1.0;
double r142 = x;
double r143 = cos(r142);
double r144 = r141 - r143;
double r145 = r142 * r142;
double r146 = r144 / r145;
return r146;
}
double f(double x) {
double r147 = x;
double r148 = -0.0343424885078094;
bool r149 = r147 <= r148;
double r150 = 1.0;
double r151 = cos(r147);
double r152 = r150 - r151;
double r153 = r152 / r147;
double r154 = r153 / r147;
double r155 = 0.033493863120598724;
bool r156 = r147 <= r155;
double r157 = 0.5;
double r158 = 0.00138888888888887;
double r159 = 5.0;
double r160 = pow(r147, r159);
double r161 = r158 * r160;
double r162 = 0.041666666666666685;
double r163 = 3.0;
double r164 = pow(r147, r163);
double r165 = r162 * r164;
double r166 = r161 - r165;
double r167 = fma(r147, r157, r166);
double r168 = r167 / r147;
double r169 = pow(r150, r163);
double r170 = r150 * r151;
double r171 = fma(r151, r151, r170);
double r172 = fma(r150, r150, r171);
double r173 = r172 * r147;
double r174 = r169 / r173;
double r175 = pow(r151, r163);
double r176 = r175 / r172;
double r177 = r176 / r147;
double r178 = r174 - r177;
double r179 = r178 / r147;
double r180 = r156 ? r168 : r179;
double r181 = r149 ? r154 : r180;
return r181;
}



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
rmApplied expm1-log1p-u61.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)))