\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.031682751964378281:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{{1}^{3}}{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right)} - \frac{{\left(\cos x\right)}^{3}}{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right)}}{x}\\
\mathbf{elif}\;x \le 0.033639018339020957:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \frac{1}{24} \cdot {x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{e^{\log \left({1}^{3} - \sqrt[3]{{\left({\left(\cos x\right)}^{3}\right)}^{3}}\right)}}{\mathsf{fma}\left(\cos x, 1 + \cos x, 1 \cdot 1\right)}}{x}\\
\end{array}double f(double x) {
double r23243 = 1.0;
double r23244 = x;
double r23245 = cos(r23244);
double r23246 = r23243 - r23245;
double r23247 = r23244 * r23244;
double r23248 = r23246 / r23247;
return r23248;
}
double f(double x) {
double r23249 = x;
double r23250 = -0.03168275196437828;
bool r23251 = r23249 <= r23250;
double r23252 = 1.0;
double r23253 = r23252 / r23249;
double r23254 = 1.0;
double r23255 = 3.0;
double r23256 = pow(r23254, r23255);
double r23257 = cos(r23249);
double r23258 = r23254 + r23257;
double r23259 = r23254 * r23254;
double r23260 = fma(r23257, r23258, r23259);
double r23261 = r23256 / r23260;
double r23262 = pow(r23257, r23255);
double r23263 = r23262 / r23260;
double r23264 = r23261 - r23263;
double r23265 = r23264 / r23249;
double r23266 = r23253 * r23265;
double r23267 = 0.03363901833902096;
bool r23268 = r23249 <= r23267;
double r23269 = 4.0;
double r23270 = pow(r23249, r23269);
double r23271 = 0.001388888888888889;
double r23272 = 0.5;
double r23273 = 0.041666666666666664;
double r23274 = 2.0;
double r23275 = pow(r23249, r23274);
double r23276 = r23273 * r23275;
double r23277 = r23272 - r23276;
double r23278 = fma(r23270, r23271, r23277);
double r23279 = pow(r23262, r23255);
double r23280 = cbrt(r23279);
double r23281 = r23256 - r23280;
double r23282 = log(r23281);
double r23283 = exp(r23282);
double r23284 = r23283 / r23260;
double r23285 = r23284 / r23249;
double r23286 = r23253 * r23285;
double r23287 = r23268 ? r23278 : r23286;
double r23288 = r23251 ? r23266 : r23287;
return r23288;
}



Bits error versus x
if x < -0.03168275196437828Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.4
rmApplied flip3--0.5
Simplified0.5
rmApplied div-sub0.5
if -0.03168275196437828 < x < 0.03363901833902096Initial program 62.4
Taylor expanded around 0 0.0
Simplified0.0
if 0.03363901833902096 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.4
rmApplied flip3--0.5
Simplified0.5
rmApplied add-cbrt-cube0.5
Simplified0.5
rmApplied add-exp-log0.5
Final simplification0.3
herbie shell --seed 2020033 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))