\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0356686461129850571 \lor \neg \left(x \le 0.02982085320761324\right):\\
\;\;\;\;\frac{\sqrt{\frac{{1}^{3} - {\left(\cos x\right)}^{3}}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}}{x} \cdot \frac{\sqrt{\log \left(e^{1 - \cos x}\right)}}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\end{array}double code(double x) {
return ((1.0 - cos(x)) / (x * x));
}
double code(double x) {
double VAR;
if (((x <= -0.03566864611298506) || !(x <= 0.02982085320761324))) {
VAR = ((sqrt(((pow(1.0, 3.0) - pow(cos(x), 3.0)) / ((cos(x) * (cos(x) + 1.0)) + (1.0 * 1.0)))) / x) * (sqrt(log(exp((1.0 - cos(x))))) / x));
} else {
VAR = (((0.001388888888888889 * pow(x, 4.0)) + 0.5) - (0.041666666666666664 * pow(x, 2.0)));
}
return VAR;
}



Bits error versus x
Results
if x < -0.03566864611298506 or 0.02982085320761324 < x Initial program 1.2
rmApplied add-sqr-sqrt1.3
Applied times-frac0.6
rmApplied add-log-exp0.6
Applied add-log-exp0.6
Applied diff-log0.6
Simplified0.6
rmApplied flip3--0.6
Simplified0.6
if -0.03566864611298506 < x < 0.02982085320761324Initial program 62.1
Taylor expanded around 0 0.0
Final simplification0.3
herbie shell --seed 2020105
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))