\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03405516779529376564239484537210955750197:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{x}{1 - \cos x}}\\
\mathbf{elif}\;x \le 0.03330291426620153594218010084659908898175:\\
\;\;\;\;\frac{\frac{1}{720} \cdot {x}^{5} + \left(x \cdot \frac{1}{2} - {x}^{3} \cdot \frac{1}{24}\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos x}{{x}^{2}}\\
\end{array}double f(double x) {
double r31983 = 1.0;
double r31984 = x;
double r31985 = cos(r31984);
double r31986 = r31983 - r31985;
double r31987 = r31984 * r31984;
double r31988 = r31986 / r31987;
return r31988;
}
double f(double x) {
double r31989 = x;
double r31990 = -0.034055167795293766;
bool r31991 = r31989 <= r31990;
double r31992 = 1.0;
double r31993 = r31992 / r31989;
double r31994 = 1.0;
double r31995 = cos(r31989);
double r31996 = r31994 - r31995;
double r31997 = r31989 / r31996;
double r31998 = r31993 / r31997;
double r31999 = 0.033302914266201536;
bool r32000 = r31989 <= r31999;
double r32001 = 0.001388888888888889;
double r32002 = 5.0;
double r32003 = pow(r31989, r32002);
double r32004 = r32001 * r32003;
double r32005 = 0.5;
double r32006 = r31989 * r32005;
double r32007 = 3.0;
double r32008 = pow(r31989, r32007);
double r32009 = 0.041666666666666664;
double r32010 = r32008 * r32009;
double r32011 = r32006 - r32010;
double r32012 = r32004 + r32011;
double r32013 = r32012 / r31989;
double r32014 = 2.0;
double r32015 = pow(r31989, r32014);
double r32016 = r31996 / r32015;
double r32017 = r32000 ? r32013 : r32016;
double r32018 = r31991 ? r31998 : r32017;
return r32018;
}



Bits error versus x
Results
if x < -0.034055167795293766Initial program 1.3
rmApplied associate-/r*0.5
rmApplied div-sub0.6
rmApplied div-inv0.6
Applied div-inv0.6
Applied distribute-rgt-out--0.5
Applied associate-/l*0.5
if -0.034055167795293766 < x < 0.033302914266201536Initial program 62.3
rmApplied associate-/r*61.3
rmApplied div-sub61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.033302914266201536 < x Initial program 1.1
rmApplied associate-/r*0.5
rmApplied div-sub0.6
rmApplied sub-div0.5
Applied associate-/l/1.1
Simplified1.1
Final simplification0.4
herbie shell --seed 2019174
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))