(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(FPCore (x eps)
:precision binary64
(if (<= x -1.194e-57)
(fma
(* eps eps)
(* (pow x 3.0) 10.0)
(fma
(* eps 5.0)
(pow x 4.0)
(* x (* (pow eps 3.0) (fma 10.0 x (* eps 5.0))))))
(if (<= x 1.82064444690524e-37)
(- (pow (+ x eps) 5.0) (pow x 5.0))
(* (pow x 3.0) (* eps (fma 10.0 eps (* x 5.0)))))))double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
double code(double x, double eps) {
double tmp;
if (x <= -1.194e-57) {
tmp = fma((eps * eps), (pow(x, 3.0) * 10.0), fma((eps * 5.0), pow(x, 4.0), (x * (pow(eps, 3.0) * fma(10.0, x, (eps * 5.0))))));
} else if (x <= 1.82064444690524e-37) {
tmp = pow((x + eps), 5.0) - pow(x, 5.0);
} else {
tmp = pow(x, 3.0) * (eps * fma(10.0, eps, (x * 5.0)));
}
return tmp;
}
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function code(x, eps) tmp = 0.0 if (x <= -1.194e-57) tmp = fma(Float64(eps * eps), Float64((x ^ 3.0) * 10.0), fma(Float64(eps * 5.0), (x ^ 4.0), Float64(x * Float64((eps ^ 3.0) * fma(10.0, x, Float64(eps * 5.0)))))); elseif (x <= 1.82064444690524e-37) tmp = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)); else tmp = Float64((x ^ 3.0) * Float64(eps * fma(10.0, eps, Float64(x * 5.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_] := If[LessEqual[x, -1.194e-57], N[(N[(eps * eps), $MachinePrecision] * N[(N[Power[x, 3.0], $MachinePrecision] * 10.0), $MachinePrecision] + N[(N[(eps * 5.0), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision] + N[(x * N[(N[Power[eps, 3.0], $MachinePrecision] * N[(10.0 * x + N[(eps * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.82064444690524e-37], N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[x, 3.0], $MachinePrecision] * N[(eps * N[(10.0 * eps + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\begin{array}{l}
\mathbf{if}\;x \leq -1.194 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon \cdot \varepsilon, {x}^{3} \cdot 10, \mathsf{fma}\left(\varepsilon \cdot 5, {x}^{4}, x \cdot \left({\varepsilon}^{3} \cdot \mathsf{fma}\left(10, x, \varepsilon \cdot 5\right)\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.82064444690524 \cdot 10^{-37}:\\
\;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{else}:\\
\;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \mathsf{fma}\left(10, \varepsilon, x \cdot 5\right)\right)\\
\end{array}
if x < -1.1940000000000001e-57Initial program 36.5
Taylor expanded in x around inf 4.9
Simplified4.9
Taylor expanded in x around 0 4.9
Simplified4.9
if -1.1940000000000001e-57 < x < 1.82064444690524e-37Initial program 0.5
if 1.82064444690524e-37 < x Initial program 43.3
Taylor expanded in x around inf 3.5
Simplified3.5
Taylor expanded in eps around 0 3.6
Simplified3.6
Taylor expanded in eps around 0 3.6
Simplified3.6
Final simplification1.2
herbie shell --seed 2022190
(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)))