(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)) 0.0)))
(if t_1
(fma (pow (cbrt (pow x 5.0)) 2.0) (cbrt (- (pow x 5.0))) t_0)
(if t_1
(*
x
(+
(* x (* (* eps eps) (* (+ x eps) 10.0)))
(* 5.0 (fma eps (pow x 3.0) (pow eps 4.0)))))
(+ (pow eps 5.0) (* x (* (pow eps 3.0) (+ (* eps 5.0) (* x 10.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);
int t_1 = (t_0 - pow(x, 5.0)) <= 0.0;
double tmp;
if (t_1) {
tmp = fma(pow(cbrt(pow(x, 5.0)), 2.0), cbrt(-pow(x, 5.0)), t_0);
} else if (t_1) {
tmp = x * ((x * ((eps * eps) * ((x + eps) * 10.0))) + (5.0 * fma(eps, pow(x, 3.0), pow(eps, 4.0))));
} else {
tmp = pow(eps, 5.0) + (x * (pow(eps, 3.0) * ((eps * 5.0) + (x * 10.0))));
}
return tmp;
}
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) <= 0.0 tmp = 0.0 if (t_1) tmp = fma((cbrt((x ^ 5.0)) ^ 2.0), cbrt(Float64(-(x ^ 5.0))), t_0); elseif (t_1) tmp = Float64(x * Float64(Float64(x * Float64(Float64(eps * eps) * Float64(Float64(x + eps) * 10.0))) + Float64(5.0 * fma(eps, (x ^ 3.0), (eps ^ 4.0))))); else tmp = Float64((eps ^ 5.0) + Float64(x * Float64((eps ^ 3.0) * Float64(Float64(eps * 5.0) + Float64(x * 10.0))))); end return tmp end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = LessEqual[N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], 0.0]}, If[t$95$1, N[(N[Power[N[Power[N[Power[x, 5.0], $MachinePrecision], 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[(-N[Power[x, 5.0], $MachinePrecision]), 1/3], $MachinePrecision] + t$95$0), $MachinePrecision], If[t$95$1, N[(x * N[(N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(N[(x + eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(eps * N[Power[x, 3.0], $MachinePrecision] + N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[eps, 5.0], $MachinePrecision] + N[(x * N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] + N[(x * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t_0 - {x}^{5} \leq 0\\
\mathbf{if}\;t_1:\\
\;\;\;\;\mathsf{fma}\left({\left(\sqrt[3]{{x}^{5}}\right)}^{2}, \sqrt[3]{-{x}^{5}}, t_0\right)\\
\mathbf{elif}\;t_1:\\
\;\;\;\;x \cdot \left(x \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(x + \varepsilon\right) \cdot 10\right)\right) + 5 \cdot \mathsf{fma}\left(\varepsilon, {x}^{3}, {\varepsilon}^{4}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5} + x \cdot \left({\varepsilon}^{3} \cdot \left(\varepsilon \cdot 5 + x \cdot 10\right)\right)\\
\end{array}



Bits error versus x



Bits error versus eps
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 8.3
Applied egg-rr13.3
Applied egg-rr13.3
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 7.7
Applied egg-rr12.2
Taylor expanded in eps around 0 10.6
Simplified10.6
Taylor expanded in eps around 0 10.6
Simplified10.6
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 1.4
Applied egg-rr1.4
Taylor expanded in eps around inf 3.0
Simplified3.0
Final simplification12.3
herbie shell --seed 2022146
(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)))