\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0266096722673715806:\\
\;\;\;\;\frac{1}{x} \cdot \frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\left(\cos x \cdot \frac{{1}^{3} + {\left(\cos x\right)}^{3}}{1 \cdot 1 + \cos x \cdot \left(\cos x - 1\right)} + 1 \cdot 1\right) \cdot x}\\
\mathbf{elif}\;x \le 0.0284410596258715502:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)}{\left(\cos x \cdot \left(1 + \cos x\right) + 1 \cdot 1\right) \cdot x}\\
\end{array}double f(double x) {
double r26548 = 1.0;
double r26549 = x;
double r26550 = cos(r26549);
double r26551 = r26548 - r26550;
double r26552 = r26549 * r26549;
double r26553 = r26551 / r26552;
return r26553;
}
double f(double x) {
double r26554 = x;
double r26555 = -0.02660967226737158;
bool r26556 = r26554 <= r26555;
double r26557 = 1.0;
double r26558 = r26557 / r26554;
double r26559 = 1.0;
double r26560 = 3.0;
double r26561 = pow(r26559, r26560);
double r26562 = cos(r26554);
double r26563 = pow(r26562, r26560);
double r26564 = r26561 - r26563;
double r26565 = r26561 + r26563;
double r26566 = r26559 * r26559;
double r26567 = r26562 - r26559;
double r26568 = r26562 * r26567;
double r26569 = r26566 + r26568;
double r26570 = r26565 / r26569;
double r26571 = r26562 * r26570;
double r26572 = r26571 + r26566;
double r26573 = r26572 * r26554;
double r26574 = r26564 / r26573;
double r26575 = r26558 * r26574;
double r26576 = 0.02844105962587155;
bool r26577 = r26554 <= r26576;
double r26578 = 0.001388888888888889;
double r26579 = 4.0;
double r26580 = pow(r26554, r26579);
double r26581 = r26578 * r26580;
double r26582 = 0.5;
double r26583 = r26581 + r26582;
double r26584 = 0.041666666666666664;
double r26585 = 2.0;
double r26586 = pow(r26554, r26585);
double r26587 = r26584 * r26586;
double r26588 = r26583 - r26587;
double r26589 = exp(r26564);
double r26590 = log(r26589);
double r26591 = r26559 + r26562;
double r26592 = r26562 * r26591;
double r26593 = r26592 + r26566;
double r26594 = r26593 * r26554;
double r26595 = r26590 / r26594;
double r26596 = r26558 * r26595;
double r26597 = r26577 ? r26588 : r26596;
double r26598 = r26556 ? r26575 : r26597;
return r26598;
}



Bits error versus x
Results
if x < -0.02660967226737158Initial program 0.9
rmApplied *-un-lft-identity0.9
Applied times-frac0.5
rmApplied flip3--0.5
Applied associate-/l/0.5
Simplified0.5
rmApplied flip3-+0.5
Simplified0.5
if -0.02660967226737158 < x < 0.02844105962587155Initial program 62.2
Taylor expanded around 0 0.0
if 0.02844105962587155 < 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
Final simplification0.3
herbie shell --seed 2020046
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))