\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03354637559076366348786990556618547998369 \lor \neg \left(x \le 0.03201386298905525146230033328720310237259\right):\\
\;\;\;\;\frac{1}{x} \cdot \frac{\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)}{x \cdot \mathsf{fma}\left(1, 1, \cos x \cdot \left(\cos x + 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{24}, x \cdot x, \mathsf{fma}\left(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right)\right)\\
\end{array}double f(double x) {
double r21222 = 1.0;
double r21223 = x;
double r21224 = cos(r21223);
double r21225 = r21222 - r21224;
double r21226 = r21223 * r21223;
double r21227 = r21225 / r21226;
return r21227;
}
double f(double x) {
double r21228 = x;
double r21229 = -0.033546375590763663;
bool r21230 = r21228 <= r21229;
double r21231 = 0.03201386298905525;
bool r21232 = r21228 <= r21231;
double r21233 = !r21232;
bool r21234 = r21230 || r21233;
double r21235 = 1.0;
double r21236 = r21235 / r21228;
double r21237 = 1.0;
double r21238 = 3.0;
double r21239 = pow(r21237, r21238);
double r21240 = cos(r21228);
double r21241 = pow(r21240, r21238);
double r21242 = r21239 - r21241;
double r21243 = exp(r21242);
double r21244 = log(r21243);
double r21245 = r21240 + r21237;
double r21246 = r21240 * r21245;
double r21247 = fma(r21237, r21237, r21246);
double r21248 = r21228 * r21247;
double r21249 = r21244 / r21248;
double r21250 = r21236 * r21249;
double r21251 = -0.041666666666666664;
double r21252 = r21228 * r21228;
double r21253 = 0.001388888888888889;
double r21254 = 4.0;
double r21255 = pow(r21228, r21254);
double r21256 = 0.5;
double r21257 = fma(r21253, r21255, r21256);
double r21258 = fma(r21251, r21252, r21257);
double r21259 = r21234 ? r21250 : r21258;
return r21259;
}



Bits error versus x
if x < -0.033546375590763663 or 0.03201386298905525 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied add-log-exp0.5
Applied add-log-exp0.5
Applied diff-log0.6
Simplified0.5
if -0.033546375590763663 < x < 0.03201386298905525Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019235 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))