\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03408999554764362976966296514547138940543:\\
\;\;\;\;\frac{\frac{\frac{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right) \cdot \left(1 - \cos x\right)}{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right)}}{x}}{x}\\
\mathbf{elif}\;x \le 0.03229563109066735382413071420160122215748:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, \frac{1}{2}, \frac{1}{720} \cdot {x}^{5} - \frac{1}{24} \cdot {x}^{3}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{x}}{x} - \frac{\frac{\cos x}{x}}{x}\\
\end{array}double f(double x) {
double r31099 = 1.0;
double r31100 = x;
double r31101 = cos(r31100);
double r31102 = r31099 - r31101;
double r31103 = r31100 * r31100;
double r31104 = r31102 / r31103;
return r31104;
}
double f(double x) {
double r31105 = x;
double r31106 = -0.03408999554764363;
bool r31107 = r31105 <= r31106;
double r31108 = cos(r31105);
double r31109 = 1.0;
double r31110 = r31109 + r31108;
double r31111 = r31109 * r31109;
double r31112 = fma(r31108, r31110, r31111);
double r31113 = r31109 - r31108;
double r31114 = r31112 * r31113;
double r31115 = r31114 / r31112;
double r31116 = r31115 / r31105;
double r31117 = r31116 / r31105;
double r31118 = 0.032295631090667354;
bool r31119 = r31105 <= r31118;
double r31120 = 0.5;
double r31121 = 0.001388888888888889;
double r31122 = 5.0;
double r31123 = pow(r31105, r31122);
double r31124 = r31121 * r31123;
double r31125 = 0.041666666666666664;
double r31126 = 3.0;
double r31127 = pow(r31105, r31126);
double r31128 = r31125 * r31127;
double r31129 = r31124 - r31128;
double r31130 = fma(r31105, r31120, r31129);
double r31131 = r31130 / r31105;
double r31132 = r31109 / r31105;
double r31133 = r31132 / r31105;
double r31134 = r31108 / r31105;
double r31135 = r31134 / r31105;
double r31136 = r31133 - r31135;
double r31137 = r31119 ? r31131 : r31136;
double r31138 = r31107 ? r31117 : r31137;
return r31138;
}



Bits error versus x
if x < -0.03408999554764363Initial program 1.1
rmApplied associate-/r*0.4
rmApplied flip3--0.5
Simplified0.5
rmApplied difference-cubes0.5
Simplified0.5
if -0.03408999554764363 < x < 0.032295631090667354Initial program 62.4
rmApplied associate-/r*61.4
Taylor expanded around 0 0.0
Simplified0.0
if 0.032295631090667354 < x Initial program 1.0
rmApplied associate-/r*0.4
rmApplied div-sub0.5
Applied div-sub0.6
Final simplification0.3
herbie shell --seed 2020001 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))