\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03296263127040889584495886310833157040179:\\
\;\;\;\;\frac{\sqrt[3]{1 - \cos x} \cdot \sqrt[3]{1 - \cos x}}{x} \cdot \frac{\sqrt[3]{1 - \cos x}}{x}\\
\mathbf{elif}\;x \le 0.02432033747417448876770862398188910447061:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{e^{\log \left({1}^{3} - {\left(\cos x\right)}^{3}\right)}}{\left(x \cdot x\right) \cdot \mathsf{fma}\left(1, 1, \cos x \cdot \left(1 + \cos x\right)\right)}\\
\end{array}double f(double x) {
double r19042 = 1.0;
double r19043 = x;
double r19044 = cos(r19043);
double r19045 = r19042 - r19044;
double r19046 = r19043 * r19043;
double r19047 = r19045 / r19046;
return r19047;
}
double f(double x) {
double r19048 = x;
double r19049 = -0.032962631270408896;
bool r19050 = r19048 <= r19049;
double r19051 = 1.0;
double r19052 = cos(r19048);
double r19053 = r19051 - r19052;
double r19054 = cbrt(r19053);
double r19055 = r19054 * r19054;
double r19056 = r19055 / r19048;
double r19057 = r19054 / r19048;
double r19058 = r19056 * r19057;
double r19059 = 0.02432033747417449;
bool r19060 = r19048 <= r19059;
double r19061 = r19048 * r19048;
double r19062 = -0.041666666666666664;
double r19063 = 0.001388888888888889;
double r19064 = 4.0;
double r19065 = pow(r19048, r19064);
double r19066 = 0.5;
double r19067 = fma(r19063, r19065, r19066);
double r19068 = fma(r19061, r19062, r19067);
double r19069 = 3.0;
double r19070 = pow(r19051, r19069);
double r19071 = pow(r19052, r19069);
double r19072 = r19070 - r19071;
double r19073 = log(r19072);
double r19074 = exp(r19073);
double r19075 = r19051 + r19052;
double r19076 = r19052 * r19075;
double r19077 = fma(r19051, r19051, r19076);
double r19078 = r19061 * r19077;
double r19079 = r19074 / r19078;
double r19080 = r19060 ? r19068 : r19079;
double r19081 = r19050 ? r19058 : r19080;
return r19081;
}



Bits error versus x
if x < -0.032962631270408896Initial program 1.2
rmApplied add-cube-cbrt1.6
Applied times-frac0.9
if -0.032962631270408896 < x < 0.02432033747417449Initial program 62.4
Taylor expanded around 0 0.0
Simplified0.0
if 0.02432033747417449 < x Initial program 1.1
rmApplied add-exp-log1.1
rmApplied flip3--1.2
Applied log-div1.2
Applied exp-diff1.2
Applied associate-/l/1.2
Simplified1.2
Final simplification0.5
herbie shell --seed 2019326 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))