\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.033994064032605062:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\log \left(e^{1 - \cos x}\right)}{x}\\
\mathbf{elif}\;x \le 0.032573444318334172:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{1}{\frac{x}{1 - \cos x}}\\
\end{array}double f(double x) {
double r26425 = 1.0;
double r26426 = x;
double r26427 = cos(r26426);
double r26428 = r26425 - r26427;
double r26429 = r26426 * r26426;
double r26430 = r26428 / r26429;
return r26430;
}
double f(double x) {
double r26431 = x;
double r26432 = -0.03399406403260506;
bool r26433 = r26431 <= r26432;
double r26434 = 1.0;
double r26435 = r26434 / r26431;
double r26436 = 1.0;
double r26437 = cos(r26431);
double r26438 = r26436 - r26437;
double r26439 = exp(r26438);
double r26440 = log(r26439);
double r26441 = r26440 / r26431;
double r26442 = r26435 * r26441;
double r26443 = 0.03257344431833417;
bool r26444 = r26431 <= r26443;
double r26445 = 0.001388888888888889;
double r26446 = 4.0;
double r26447 = pow(r26431, r26446);
double r26448 = r26445 * r26447;
double r26449 = 0.5;
double r26450 = r26448 + r26449;
double r26451 = 0.041666666666666664;
double r26452 = 2.0;
double r26453 = pow(r26431, r26452);
double r26454 = r26451 * r26453;
double r26455 = r26450 - r26454;
double r26456 = r26431 / r26438;
double r26457 = r26434 / r26456;
double r26458 = r26435 * r26457;
double r26459 = r26444 ? r26455 : r26458;
double r26460 = r26433 ? r26442 : r26459;
return r26460;
}



Bits error versus x
Results
if x < -0.03399406403260506Initial program 1.2
rmApplied *-un-lft-identity1.2
Applied times-frac0.4
rmApplied add-log-exp0.5
Applied add-log-exp0.5
Applied diff-log0.6
Simplified0.5
if -0.03399406403260506 < x < 0.03257344431833417Initial program 62.1
Taylor expanded around 0 0.0
if 0.03257344431833417 < x Initial program 0.9
rmApplied *-un-lft-identity0.9
Applied times-frac0.4
rmApplied clear-num0.5
Final simplification0.3
herbie shell --seed 2020021
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))