\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03396454979348009078909953473157656844705:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{{1}^{3} - \log \left(e^{{\left(\cos x\right)}^{3}}\right)}{\cos x \cdot \frac{{\left(\cos x\right)}^{2} - 1 \cdot 1}{\cos x - 1} + 1 \cdot 1}}{x}\\
\mathbf{elif}\;x \le 0.03141600742422194503244980978706735186279:\\
\;\;\;\;\left(\frac{1}{720} \cdot {x}^{4} + \frac{1}{2}\right) - \frac{1}{24} \cdot {x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{{1}^{3} - \sqrt[3]{{\left({\left(\cos x\right)}^{3}\right)}^{3}}}{\cos x \cdot \left(\cos x + 1\right) + 1 \cdot 1}}{x}\\
\end{array}double f(double x) {
double r31199 = 1.0;
double r31200 = x;
double r31201 = cos(r31200);
double r31202 = r31199 - r31201;
double r31203 = r31200 * r31200;
double r31204 = r31202 / r31203;
return r31204;
}
double f(double x) {
double r31205 = x;
double r31206 = -0.03396454979348009;
bool r31207 = r31205 <= r31206;
double r31208 = 1.0;
double r31209 = r31208 / r31205;
double r31210 = 1.0;
double r31211 = 3.0;
double r31212 = pow(r31210, r31211);
double r31213 = cos(r31205);
double r31214 = pow(r31213, r31211);
double r31215 = exp(r31214);
double r31216 = log(r31215);
double r31217 = r31212 - r31216;
double r31218 = 2.0;
double r31219 = pow(r31213, r31218);
double r31220 = r31210 * r31210;
double r31221 = r31219 - r31220;
double r31222 = r31213 - r31210;
double r31223 = r31221 / r31222;
double r31224 = r31213 * r31223;
double r31225 = r31224 + r31220;
double r31226 = r31217 / r31225;
double r31227 = r31226 / r31205;
double r31228 = r31209 * r31227;
double r31229 = 0.031416007424221945;
bool r31230 = r31205 <= r31229;
double r31231 = 0.001388888888888889;
double r31232 = 4.0;
double r31233 = pow(r31205, r31232);
double r31234 = r31231 * r31233;
double r31235 = 0.5;
double r31236 = r31234 + r31235;
double r31237 = 0.041666666666666664;
double r31238 = pow(r31205, r31218);
double r31239 = r31237 * r31238;
double r31240 = r31236 - r31239;
double r31241 = pow(r31214, r31211);
double r31242 = cbrt(r31241);
double r31243 = r31212 - r31242;
double r31244 = r31213 + r31210;
double r31245 = r31213 * r31244;
double r31246 = r31245 + r31220;
double r31247 = r31243 / r31246;
double r31248 = r31247 / r31205;
double r31249 = r31209 * r31248;
double r31250 = r31230 ? r31240 : r31249;
double r31251 = r31207 ? r31228 : r31250;
return r31251;
}



Bits error versus x
Results
if x < -0.03396454979348009Initial program 1.1
rmApplied *-un-lft-identity1.1
Applied times-frac0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied add-log-exp0.5
rmApplied flip-+0.5
Simplified0.5
if -0.03396454979348009 < x < 0.031416007424221945Initial program 62.2
Taylor expanded around 0 0.0
if 0.031416007424221945 < x Initial program 1.2
rmApplied *-un-lft-identity1.2
Applied times-frac0.5
rmApplied flip3--0.5
Simplified0.5
rmApplied add-log-exp0.5
rmApplied add-cbrt-cube0.6
Simplified0.5
Final simplification0.3
herbie shell --seed 2019347
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))