\frac{1 - \cos x}{x \cdot x}\frac{\frac{\sin \left(x \cdot \frac{1}{2}\right)}{x}}{\frac{\cos \left(x \cdot \frac{1}{2}\right)}{\frac{\sin x}{x}}}double f(double x) {
double r5445420 = 1.0;
double r5445421 = x;
double r5445422 = cos(r5445421);
double r5445423 = r5445420 - r5445422;
double r5445424 = r5445421 * r5445421;
double r5445425 = r5445423 / r5445424;
return r5445425;
}
double f(double x) {
double r5445426 = x;
double r5445427 = 0.5;
double r5445428 = r5445426 * r5445427;
double r5445429 = sin(r5445428);
double r5445430 = r5445429 / r5445426;
double r5445431 = cos(r5445428);
double r5445432 = sin(r5445426);
double r5445433 = r5445432 / r5445426;
double r5445434 = r5445431 / r5445433;
double r5445435 = r5445430 / r5445434;
return r5445435;
}



Bits error versus x
Results
Initial program 30.5
rmApplied flip--30.6
Applied associate-/l/30.6
Simplified14.7
rmApplied clear-num14.7
rmApplied times-frac15.1
Applied add-cube-cbrt15.1
Applied times-frac15.1
Simplified15.1
Simplified15.0
Taylor expanded around inf 14.8
Simplified0.2
Final simplification0.2
herbie shell --seed 2019120
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1 (cos x)) (* x x)))