\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0319510738025488294500320307633955962956 \lor \neg \left(x \le 0.02827821813838137660068738910013053100556\right):\\
\;\;\;\;\frac{\frac{e^{\log \left(\log \left(e^{{1}^{3} - {\left(\cos x\right)}^{3}}\right)\right) - \log \left(1 \cdot 1 + \left(\cos x \cdot \cos x + 1 \cdot \cos x\right)\right)}}{x}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\end{array}double f(double x) {
double r21092 = 1.0;
double r21093 = x;
double r21094 = cos(r21093);
double r21095 = r21092 - r21094;
double r21096 = r21093 * r21093;
double r21097 = r21095 / r21096;
return r21097;
}
double f(double x) {
double r21098 = x;
double r21099 = -0.03195107380254883;
bool r21100 = r21098 <= r21099;
double r21101 = 0.028278218138381377;
bool r21102 = r21098 <= r21101;
double r21103 = !r21102;
bool r21104 = r21100 || r21103;
double r21105 = 1.0;
double r21106 = 3.0;
double r21107 = pow(r21105, r21106);
double r21108 = cos(r21098);
double r21109 = pow(r21108, r21106);
double r21110 = r21107 - r21109;
double r21111 = exp(r21110);
double r21112 = log(r21111);
double r21113 = log(r21112);
double r21114 = r21105 * r21105;
double r21115 = r21108 * r21108;
double r21116 = r21105 * r21108;
double r21117 = r21115 + r21116;
double r21118 = r21114 + r21117;
double r21119 = log(r21118);
double r21120 = r21113 - r21119;
double r21121 = exp(r21120);
double r21122 = r21121 / r21098;
double r21123 = r21122 / r21098;
double r21124 = 0.001388888888888889;
double r21125 = 4.0;
double r21126 = pow(r21098, r21125);
double r21127 = r21124 * r21126;
double r21128 = 0.5;
double r21129 = r21127 + r21128;
double r21130 = 0.041666666666666664;
double r21131 = 2.0;
double r21132 = pow(r21098, r21131);
double r21133 = r21130 * r21132;
double r21134 = r21129 - r21133;
double r21135 = r21104 ? r21123 : r21134;
return r21135;
}



Bits error versus x
Results
if x < -0.03195107380254883 or 0.028278218138381377 < x Initial program 1.0
rmApplied associate-/r*0.5
rmApplied add-exp-log0.5
rmApplied flip3--0.5
Applied log-div0.5
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.6
Simplified0.6
if -0.03195107380254883 < x < 0.028278218138381377Initial program 62.2
Taylor expanded around 0 0.0
Final simplification0.3
herbie shell --seed 2019294
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))