{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t_0 - {x}^{5}\\
\mathbf{if}\;t_1 \leq -3.769278611 \cdot 10^{-314}:\\
\;\;\;\;10 \cdot \left({\varepsilon}^{3} \cdot {x}^{2}\right) + \left({\varepsilon}^{5} + \left(5 \cdot \left(x \cdot {\varepsilon}^{4}\right) + 10 \cdot \left({\varepsilon}^{2} \cdot {x}^{3}\right)\right)\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4} + 10 \cdot \left(x \cdot \left(x \cdot {\varepsilon}^{2}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-1, {x}^{5}, t_0\right)\\
\end{array}
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0)) (t_1 (- t_0 (pow x 5.0))))
(if (<= t_1 -3.769278611e-314)
(+
(* 10.0 (* (pow eps 3.0) (pow x 2.0)))
(+
(pow eps 5.0)
(+ (* 5.0 (* x (pow eps 4.0))) (* 10.0 (* (pow eps 2.0) (pow x 3.0))))))
(if (<= t_1 0.0)
(* eps (+ (* 5.0 (pow x 4.0)) (* 10.0 (* x (* x (pow eps 2.0))))))
(fma -1.0 (pow x 5.0) t_0)))))double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double tmp;
if (t_1 <= -3.769278611e-314) {
tmp = (10.0 * (pow(eps, 3.0) * pow(x, 2.0))) + (pow(eps, 5.0) + ((5.0 * (x * pow(eps, 4.0))) + (10.0 * (pow(eps, 2.0) * pow(x, 3.0)))));
} else if (t_1 <= 0.0) {
tmp = eps * ((5.0 * pow(x, 4.0)) + (10.0 * (x * (x * pow(eps, 2.0)))));
} else {
tmp = fma(-1.0, pow(x, 5.0), t_0);
}
return tmp;
}



Bits error versus x



Bits error versus eps
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -3.769278611e-314Initial program 1.4
Taylor expanded in x around 0 3.8
if -3.769278611e-314 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 8.4
Taylor expanded in x around inf 0.1
Simplified0.1
Taylor expanded in x around 0 0.1
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 1.2
Applied egg-rr1.2
Final simplification0.6
herbie shell --seed 2022130
(FPCore (x eps)
:name "ENA, Section 1.4, Exercise 4b, n=5"
:precision binary64
:pre (and (and (<= -1000000000.0 x) (<= x 1000000000.0)) (and (<= -1.0 eps) (<= eps 1.0)))
(- (pow (+ x eps) 5.0) (pow x 5.0)))