\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03305631426271166128927347926946822553873:\\
\;\;\;\;\frac{1}{x} \cdot \frac{{1}^{3} - {\left(\cos x\right)}^{3}}{x \cdot \mathsf{fma}\left(\cos x, \left(\sqrt[3]{1 + \cos x} \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{1 + \cos x}\right)\right)\right) \cdot \sqrt[3]{1 + \cos x}, 1 \cdot 1\right)}\\
\mathbf{elif}\;x \le 0.03330291426620153594218010084659908898175:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(x \cdot x, \left(x \cdot x\right) \cdot \frac{1}{720}, \frac{1}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1 - \cos x}{x \cdot x}\\
\end{array}double f(double x) {
double r878256 = 1.0;
double r878257 = x;
double r878258 = cos(r878257);
double r878259 = r878256 - r878258;
double r878260 = r878257 * r878257;
double r878261 = r878259 / r878260;
return r878261;
}
double f(double x) {
double r878262 = x;
double r878263 = -0.03305631426271166;
bool r878264 = r878262 <= r878263;
double r878265 = 1.0;
double r878266 = r878265 / r878262;
double r878267 = 1.0;
double r878268 = 3.0;
double r878269 = pow(r878267, r878268);
double r878270 = cos(r878262);
double r878271 = pow(r878270, r878268);
double r878272 = r878269 - r878271;
double r878273 = r878267 + r878270;
double r878274 = cbrt(r878273);
double r878275 = log1p(r878274);
double r878276 = expm1(r878275);
double r878277 = r878274 * r878276;
double r878278 = r878277 * r878274;
double r878279 = r878267 * r878267;
double r878280 = fma(r878270, r878278, r878279);
double r878281 = r878262 * r878280;
double r878282 = r878272 / r878281;
double r878283 = r878266 * r878282;
double r878284 = 0.033302914266201536;
bool r878285 = r878262 <= r878284;
double r878286 = r878262 * r878262;
double r878287 = -0.041666666666666664;
double r878288 = 0.001388888888888889;
double r878289 = r878286 * r878288;
double r878290 = 0.5;
double r878291 = fma(r878286, r878289, r878290);
double r878292 = fma(r878286, r878287, r878291);
double r878293 = r878267 - r878270;
double r878294 = r878293 / r878286;
double r878295 = r878285 ? r878292 : r878294;
double r878296 = r878264 ? r878283 : r878295;
return r878296;
}



Bits error versus x
if x < -0.03305631426271166Initial program 1.3
rmApplied *-un-lft-identity1.3
Applied times-frac0.5
rmApplied flip3--0.6
Applied associate-/l/0.6
Simplified0.6
rmApplied add-cube-cbrt0.6
rmApplied expm1-log1p-u0.6
if -0.03305631426271166 < x < 0.033302914266201536Initial program 62.3
rmApplied *-un-lft-identity62.3
Applied times-frac61.3
Taylor expanded around 0 0.0
Simplified0.0
if 0.033302914266201536 < x Initial program 1.1
rmApplied *-un-lft-identity1.1
Applied times-frac0.5
rmApplied *-un-lft-identity0.5
Applied associate-*l*0.5
Simplified1.1
Final simplification0.4
herbie shell --seed 2019174 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
(/ (- 1.0 (cos x)) (* x x)))