\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03059660473543995840017828413692768663168:\\
\;\;\;\;\frac{\sqrt{1 - \cos x}}{x} \cdot \frac{\sqrt{1 - \cos x}}{x}\\
\mathbf{elif}\;x \le 0.03249397456549534685121827237708203028888:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{e^{\log \left(\frac{\left(1 \cdot 1 + \cos x \cdot \left(\cos x + 1\right)\right) \cdot \left(1 - \cos x\right)}{\cos x \cdot \left(1 + \cos x\right) + 1 \cdot 1}\right)}}{x}\\
\end{array}double f(double x) {
double r24505 = 1.0;
double r24506 = x;
double r24507 = cos(r24506);
double r24508 = r24505 - r24507;
double r24509 = r24506 * r24506;
double r24510 = r24508 / r24509;
return r24510;
}
double f(double x) {
double r24511 = x;
double r24512 = -0.03059660473543996;
bool r24513 = r24511 <= r24512;
double r24514 = 1.0;
double r24515 = cos(r24511);
double r24516 = r24514 - r24515;
double r24517 = sqrt(r24516);
double r24518 = r24517 / r24511;
double r24519 = r24518 * r24518;
double r24520 = 0.03249397456549535;
bool r24521 = r24511 <= r24520;
double r24522 = 0.001388888888888889;
double r24523 = 4.0;
double r24524 = pow(r24511, r24523);
double r24525 = r24522 * r24524;
double r24526 = 0.5;
double r24527 = r24525 + r24526;
double r24528 = 0.041666666666666664;
double r24529 = 2.0;
double r24530 = pow(r24511, r24529);
double r24531 = r24528 * r24530;
double r24532 = r24527 - r24531;
double r24533 = 1.0;
double r24534 = r24533 / r24511;
double r24535 = r24514 * r24514;
double r24536 = r24515 + r24514;
double r24537 = r24515 * r24536;
double r24538 = r24535 + r24537;
double r24539 = r24538 * r24516;
double r24540 = r24514 + r24515;
double r24541 = r24515 * r24540;
double r24542 = r24541 + r24535;
double r24543 = r24539 / r24542;
double r24544 = log(r24543);
double r24545 = exp(r24544);
double r24546 = r24545 / r24511;
double r24547 = r24534 * r24546;
double r24548 = r24521 ? r24532 : r24547;
double r24549 = r24513 ? r24519 : r24548;
return r24549;
}



Bits error versus x
Results
if x < -0.03059660473543996Initial program 1.1
rmApplied add-sqr-sqrt1.2
Applied times-frac0.6
if -0.03059660473543996 < x < 0.03249397456549535Initial program 62.2
Taylor expanded around 0 0.0
if 0.03249397456549535 < x Initial program 1.0
rmApplied *-un-lft-identity1.0
Applied times-frac0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied add-exp-log0.5
Applied add-exp-log0.5
Applied div-exp0.5
Simplified0.5
rmApplied difference-cubes0.5
Simplified0.5
Final simplification0.3
herbie shell --seed 2019305
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))