\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.0354600816886072659:\\
\;\;\;\;\frac{1 \cdot \left({1}^{3} - {\left(\cos x\right)}^{3}\right)}{x} \cdot \frac{\frac{1}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}{x}\\
\mathbf{elif}\;x \le 0.030404078865847541:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{{1}^{3} - \log \left(e^{{\left(\cos x\right)}^{3}}\right)}{\cos x \cdot \frac{{\left(\cos x\right)}^{2} - 1 \cdot 1}{\cos x - 1} + 1 \cdot 1}}{x}\\
\end{array}double f(double x) {
double r34357 = 1.0;
double r34358 = x;
double r34359 = cos(r34358);
double r34360 = r34357 - r34359;
double r34361 = r34358 * r34358;
double r34362 = r34360 / r34361;
return r34362;
}
double f(double x) {
double r34363 = x;
double r34364 = -0.035460081688607266;
bool r34365 = r34363 <= r34364;
double r34366 = 1.0;
double r34367 = 1.0;
double r34368 = 3.0;
double r34369 = pow(r34367, r34368);
double r34370 = cos(r34363);
double r34371 = pow(r34370, r34368);
double r34372 = r34369 - r34371;
double r34373 = r34366 * r34372;
double r34374 = r34373 / r34363;
double r34375 = r34370 + r34367;
double r34376 = r34370 * r34375;
double r34377 = r34367 * r34367;
double r34378 = r34376 + r34377;
double r34379 = r34366 / r34378;
double r34380 = r34379 / r34363;
double r34381 = r34374 * r34380;
double r34382 = 0.03040407886584754;
bool r34383 = r34363 <= r34382;
double r34384 = 0.001388888888888889;
double r34385 = 4.0;
double r34386 = pow(r34363, r34385);
double r34387 = r34384 * r34386;
double r34388 = 0.5;
double r34389 = r34387 + r34388;
double r34390 = 0.041666666666666664;
double r34391 = 2.0;
double r34392 = pow(r34363, r34391);
double r34393 = r34390 * r34392;
double r34394 = r34389 - r34393;
double r34395 = r34366 / r34363;
double r34396 = exp(r34371);
double r34397 = log(r34396);
double r34398 = r34369 - r34397;
double r34399 = pow(r34370, r34391);
double r34400 = r34399 - r34377;
double r34401 = r34370 - r34367;
double r34402 = r34400 / r34401;
double r34403 = r34370 * r34402;
double r34404 = r34403 + r34377;
double r34405 = r34398 / r34404;
double r34406 = r34405 / r34363;
double r34407 = r34395 * r34406;
double r34408 = r34383 ? r34394 : r34407;
double r34409 = r34365 ? r34381 : r34408;
return r34409;
}



Bits error versus x
Results
if x < -0.035460081688607266Initial program 1.2
rmApplied *-un-lft-identity1.2
Applied times-frac0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied *-un-lft-identity0.5
Applied div-inv0.5
Applied times-frac0.6
Applied associate-*r*0.6
Simplified0.5
if -0.035460081688607266 < x < 0.03040407886584754Initial program 62.3
Taylor expanded around 0 0.0
if 0.03040407886584754 < x Initial program 0.9
rmApplied *-un-lft-identity0.9
Applied times-frac0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied add-log-exp0.5
rmApplied flip-+0.5
Simplified0.5
Final simplification0.3
herbie shell --seed 2020062
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))