{\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.0312 \cdot 10^{-319}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt[3]{{x}^{5}}\\
t_0 - t_2 \cdot \left(t_2 \cdot t_2\right)
\end{array}\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_3 := x \cdot {\varepsilon}^{4}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, 5 \cdot {x}^{4}, \mathsf{fma}\left(5, t_3, \left(x \cdot x\right) \cdot \left(10 \cdot {\varepsilon}^{3}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5} + \mathsf{fma}\left(5, t_3, \left(x \cdot x\right) \cdot \left(\left(x + \varepsilon\right) \cdot \left(10 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\right)\\
\end{array}\\
\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.0312e-319)
(let* ((t_2 (cbrt (pow x 5.0)))) (- t_0 (* t_2 (* t_2 t_2))))
(let* ((t_3 (* x (pow eps 4.0))))
(if (<= t_1 0.0)
(fma
eps
(* 5.0 (pow x 4.0))
(fma 5.0 t_3 (* (* x x) (* 10.0 (pow eps 3.0)))))
(+
(pow eps 5.0)
(fma 5.0 t_3 (* (* x x) (* (+ x eps) (* 10.0 (* eps eps)))))))))))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.0312e-319) {
double t_2_1 = cbrt(pow(x, 5.0));
tmp = t_0 - (t_2_1 * (t_2_1 * t_2_1));
} else {
double t_3 = x * pow(eps, 4.0);
double tmp_2;
if (t_1 <= 0.0) {
tmp_2 = fma(eps, (5.0 * pow(x, 4.0)), fma(5.0, t_3, ((x * x) * (10.0 * pow(eps, 3.0)))));
} else {
tmp_2 = pow(eps, 5.0) + fma(5.0, t_3, ((x * x) * ((x + eps) * (10.0 * (eps * eps)))));
}
tmp = tmp_2;
}
return tmp;
}



Bits error versus x



Bits error versus eps
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -3.03119e-319Initial program 1.6
Applied add-cube-cbrt_binary641.7
Applied cancel-sign-sub-inv_binary641.7
if -3.03119e-319 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -0.0Initial program 8.9
Taylor expanded in x around inf 0.1
Simplified0.1
Taylor expanded in eps around inf 0.1
if -0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 1.4
Taylor expanded in x around 0 3.6
Simplified3.6
Final simplification0.5
herbie shell --seed 2022097
(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)))