\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03422954134275022625155671107677335385233 \lor \neg \left(x \le 0.03575238836244829659927191300994309131056\right):\\
\;\;\;\;\frac{\sqrt{\log \left(e^{1 - \cos x}\right)} \cdot \left|\sqrt[3]{1 - \cos x}\right|}{x} \cdot \frac{\sqrt{\sqrt[3]{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\mathsf{fma}\left(1, 1, \cos x \cdot \left(\cos x + 1\right)\right)}}}}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left({x}^{4}, \frac{1}{720}, \frac{1}{2} - \frac{1}{24} \cdot {x}^{2}\right)\\
\end{array}double f(double x) {
double r36368 = 1.0;
double r36369 = x;
double r36370 = cos(r36369);
double r36371 = r36368 - r36370;
double r36372 = r36369 * r36369;
double r36373 = r36371 / r36372;
return r36373;
}
double f(double x) {
double r36374 = x;
double r36375 = -0.034229541342750226;
bool r36376 = r36374 <= r36375;
double r36377 = 0.0357523883624483;
bool r36378 = r36374 <= r36377;
double r36379 = !r36378;
bool r36380 = r36376 || r36379;
double r36381 = 1.0;
double r36382 = cos(r36374);
double r36383 = r36381 - r36382;
double r36384 = exp(r36383);
double r36385 = log(r36384);
double r36386 = sqrt(r36385);
double r36387 = cbrt(r36383);
double r36388 = fabs(r36387);
double r36389 = r36386 * r36388;
double r36390 = r36389 / r36374;
double r36391 = 3.0;
double r36392 = pow(r36381, r36391);
double r36393 = pow(r36382, r36391);
double r36394 = r36392 - r36393;
double r36395 = r36382 + r36381;
double r36396 = r36382 * r36395;
double r36397 = fma(r36381, r36381, r36396);
double r36398 = r36394 / r36397;
double r36399 = cbrt(r36398);
double r36400 = sqrt(r36399);
double r36401 = r36400 / r36374;
double r36402 = r36390 * r36401;
double r36403 = 4.0;
double r36404 = pow(r36374, r36403);
double r36405 = 0.001388888888888889;
double r36406 = 0.5;
double r36407 = 0.041666666666666664;
double r36408 = 2.0;
double r36409 = pow(r36374, r36408);
double r36410 = r36407 * r36409;
double r36411 = r36406 - r36410;
double r36412 = fma(r36404, r36405, r36411);
double r36413 = r36380 ? r36402 : r36412;
return r36413;
}



Bits error versus x
if x < -0.034229541342750226 or 0.0357523883624483 < x Initial program 1.1
rmApplied add-sqr-sqrt1.3
Applied times-frac0.6
rmApplied *-un-lft-identity0.6
Applied add-cube-cbrt0.7
Applied sqrt-prod0.7
Applied times-frac0.7
Applied associate-*r*0.7
Simplified0.7
rmApplied add-log-exp0.7
Applied add-log-exp0.7
Applied diff-log0.8
Simplified0.7
rmApplied flip3--0.7
Simplified0.7
if -0.034229541342750226 < x < 0.0357523883624483Initial program 62.1
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.4
herbie shell --seed 2019352 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))