\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 r19217 = 1.0;
double r19218 = x;
double r19219 = cos(r19218);
double r19220 = r19217 - r19219;
double r19221 = r19218 * r19218;
double r19222 = r19220 / r19221;
return r19222;
}
double f(double x) {
double r19223 = x;
double r19224 = -0.032962631270408896;
bool r19225 = r19223 <= r19224;
double r19226 = 1.0;
double r19227 = cos(r19223);
double r19228 = r19226 - r19227;
double r19229 = cbrt(r19228);
double r19230 = r19229 * r19229;
double r19231 = r19230 / r19223;
double r19232 = r19229 / r19223;
double r19233 = r19231 * r19232;
double r19234 = 0.02432033747417449;
bool r19235 = r19223 <= r19234;
double r19236 = r19223 * r19223;
double r19237 = -0.041666666666666664;
double r19238 = 0.001388888888888889;
double r19239 = 4.0;
double r19240 = pow(r19223, r19239);
double r19241 = 0.5;
double r19242 = fma(r19238, r19240, r19241);
double r19243 = fma(r19236, r19237, r19242);
double r19244 = 3.0;
double r19245 = pow(r19226, r19244);
double r19246 = pow(r19227, r19244);
double r19247 = r19245 - r19246;
double r19248 = log(r19247);
double r19249 = exp(r19248);
double r19250 = r19226 + r19227;
double r19251 = r19227 * r19250;
double r19252 = fma(r19226, r19226, r19251);
double r19253 = r19236 * r19252;
double r19254 = r19249 / r19253;
double r19255 = r19235 ? r19243 : r19254;
double r19256 = r19225 ? r19233 : r19255;
return r19256;
}



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)))