\frac{1 - \cos x}{x \cdot x}\frac{\frac{\frac{\sin x}{x}}{x} \cdot \sin x}{\cos x + 1}double f(double x) {
double r836421 = 1.0;
double r836422 = x;
double r836423 = cos(r836422);
double r836424 = r836421 - r836423;
double r836425 = r836422 * r836422;
double r836426 = r836424 / r836425;
return r836426;
}
double f(double x) {
double r836427 = x;
double r836428 = sin(r836427);
double r836429 = r836428 / r836427;
double r836430 = r836429 / r836427;
double r836431 = r836430 * r836428;
double r836432 = cos(r836427);
double r836433 = 1.0;
double r836434 = r836432 + r836433;
double r836435 = r836431 / r836434;
return r836435;
}



Bits error versus x
Results
Initial program 31.4
rmApplied flip--31.5
Simplified15.7
Taylor expanded around inf 15.5
Simplified0.3
rmApplied *-un-lft-identity0.3
Applied add-sqr-sqrt31.4
Applied times-frac31.4
Applied *-un-lft-identity31.4
Applied add-sqr-sqrt31.5
Applied times-frac31.5
Applied swap-sqr31.5
Simplified31.4
Simplified0.4
Final simplification0.4
herbie shell --seed 2019164
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1 (cos x)) (* x x)))