\frac{1 - \cos x}{x \cdot x}\begin{array}{l}
\mathbf{if}\;x \le -0.03309682507506567228361404886527452617884 \lor \neg \left(x \le 0.03227596253233405709792691595794167369604\right):\\
\;\;\;\;\frac{1 - \cos x}{x} \cdot \frac{1}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, \frac{-1}{24}, \mathsf{fma}\left(\frac{1}{720}, {x}^{4}, \frac{1}{2}\right)\right)\\
\end{array}double f(double x) {
double r27516 = 1.0;
double r27517 = x;
double r27518 = cos(r27517);
double r27519 = r27516 - r27518;
double r27520 = r27517 * r27517;
double r27521 = r27519 / r27520;
return r27521;
}
double f(double x) {
double r27522 = x;
double r27523 = -0.03309682507506567;
bool r27524 = r27522 <= r27523;
double r27525 = 0.03227596253233406;
bool r27526 = r27522 <= r27525;
double r27527 = !r27526;
bool r27528 = r27524 || r27527;
double r27529 = 1.0;
double r27530 = cos(r27522);
double r27531 = r27529 - r27530;
double r27532 = r27531 / r27522;
double r27533 = 1.0;
double r27534 = r27533 / r27522;
double r27535 = r27532 * r27534;
double r27536 = r27522 * r27522;
double r27537 = -0.041666666666666664;
double r27538 = 0.001388888888888889;
double r27539 = 4.0;
double r27540 = pow(r27522, r27539);
double r27541 = 0.5;
double r27542 = fma(r27538, r27540, r27541);
double r27543 = fma(r27536, r27537, r27542);
double r27544 = r27528 ? r27535 : r27543;
return r27544;
}



Bits error versus x
if x < -0.03309682507506567 or 0.03227596253233406 < x Initial program 1.0
rmApplied associate-/r*0.5
rmApplied div-inv0.5
if -0.03309682507506567 < x < 0.03227596253233406Initial program 62.2
Taylor expanded around 0 0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019351 +o rules:numerics
(FPCore (x)
:name "cos2 (problem 3.4.1)"
:precision binary64
(/ (- 1 (cos x)) (* x x)))