
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps): return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function tmp = code(x, eps) tmp = ((x + eps) ^ 5.0) - (x ^ 5.0); end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps): return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function tmp = code(x, eps) tmp = ((x + eps) ^ 5.0) - (x ^ 5.0); end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-317)
t_0
(if (<= t_0 0.0)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
t_0))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-317) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 96.3%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 90.3%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
Applied rewrites100.0%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-317)
(*
(pow eps 5.0)
(+ 1.0 (/ (fma 5.0 x (/ (* -10.0 (* x x)) (- eps))) eps)))
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
(fma
(* (* (fma (* 5.0 eps) eps (* (* (+ eps x) x) 10.0)) eps) eps)
x
(pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-317) {
tmp = pow(eps, 5.0) * (1.0 + (fma(5.0, x, ((-10.0 * (x * x)) / -eps)) / eps));
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = fma(((fma((5.0 * eps), eps, (((eps + x) * x) * 10.0)) * eps) * eps), x, pow(eps, 5.0));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-317) tmp = Float64((eps ^ 5.0) * Float64(1.0 + Float64(fma(5.0, x, Float64(Float64(-10.0 * Float64(x * x)) / Float64(-eps))) / eps))); elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = fma(Float64(Float64(fma(Float64(5.0 * eps), eps, Float64(Float64(Float64(eps + x) * x) * 10.0)) * eps) * eps), x, (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(1.0 + N[(N[(5.0 * x + N[(N[(-10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(N[(5.0 * eps), $MachinePrecision] * eps + N[(N[(N[(eps + x), $MachinePrecision] * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * x + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + \frac{\mathsf{fma}\left(5, x, \frac{-10 \cdot \left(x \cdot x\right)}{-\varepsilon}\right)}{\varepsilon}\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(5 \cdot \varepsilon, \varepsilon, \left(\left(\varepsilon + x\right) \cdot x\right) \cdot 10\right) \cdot \varepsilon\right) \cdot \varepsilon, x, {\varepsilon}^{5}\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317Initial program 97.7%
Taylor expanded in eps around -inf
associate-*r*N/A
*-commutativeN/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
distribute-lft1-inN/A
associate-*l*N/A
Applied rewrites90.6%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
if 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites94.9%
Taylor expanded in eps around 0
Applied rewrites94.9%
Final simplification98.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-317)
(* (pow eps 3.0) (fma (fma 5.0 x eps) eps (* (* 10.0 x) x)))
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
(fma
(* (* (fma (* 5.0 eps) eps (* (* (+ eps x) x) 10.0)) eps) eps)
x
(pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-317) {
tmp = pow(eps, 3.0) * fma(fma(5.0, x, eps), eps, ((10.0 * x) * x));
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = fma(((fma((5.0 * eps), eps, (((eps + x) * x) * 10.0)) * eps) * eps), x, pow(eps, 5.0));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-317) tmp = Float64((eps ^ 3.0) * fma(fma(5.0, x, eps), eps, Float64(Float64(10.0 * x) * x))); elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = fma(Float64(Float64(fma(Float64(5.0 * eps), eps, Float64(Float64(Float64(eps + x) * x) * 10.0)) * eps) * eps), x, (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(10.0 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(N[(5.0 * eps), $MachinePrecision] * eps + N[(N[(N[(eps + x), $MachinePrecision] * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * x + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;{\varepsilon}^{3} \cdot \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(10 \cdot x\right) \cdot x\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(\mathsf{fma}\left(5 \cdot \varepsilon, \varepsilon, \left(\left(\varepsilon + x\right) \cdot x\right) \cdot 10\right) \cdot \varepsilon\right) \cdot \varepsilon, x, {\varepsilon}^{5}\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317Initial program 97.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites90.1%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
if 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites94.9%
Taylor expanded in eps around 0
Applied rewrites94.9%
Final simplification97.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-317)
(* (pow eps 3.0) (fma (fma 5.0 x eps) eps (* (* 10.0 x) x)))
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
(*
(* eps eps)
(fma (* (+ eps x) (* x x)) 10.0 (* (* (fma 5.0 x eps) eps) eps)))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-317) {
tmp = pow(eps, 3.0) * fma(fma(5.0, x, eps), eps, ((10.0 * x) * x));
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = (eps * eps) * fma(((eps + x) * (x * x)), 10.0, ((fma(5.0, x, eps) * eps) * eps));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-317) tmp = Float64((eps ^ 3.0) * fma(fma(5.0, x, eps), eps, Float64(Float64(10.0 * x) * x))); elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = Float64(Float64(eps * eps) * fma(Float64(Float64(eps + x) * Float64(x * x)), 10.0, Float64(Float64(fma(5.0, x, eps) * eps) * eps))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(10.0 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(eps * eps), $MachinePrecision] * N[(N[(N[(eps + x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 10.0 + N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;{\varepsilon}^{3} \cdot \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(10 \cdot x\right) \cdot x\right)\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(\left(\varepsilon + x\right) \cdot \left(x \cdot x\right), 10, \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317Initial program 97.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6489.4
Applied rewrites89.4%
Taylor expanded in x around 0
Applied rewrites90.1%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
if 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites94.9%
Taylor expanded in eps around 0
Applied rewrites94.1%
Final simplification97.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-317)
(* (fma (/ x eps) 5.0 1.0) (pow eps 5.0))
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
(*
(* eps eps)
(fma (* (+ eps x) (* x x)) 10.0 (* (* (fma 5.0 x eps) eps) eps)))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-317) {
tmp = fma((x / eps), 5.0, 1.0) * pow(eps, 5.0);
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = (eps * eps) * fma(((eps + x) * (x * x)), 10.0, ((fma(5.0, x, eps) * eps) * eps));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-317) tmp = Float64(fma(Float64(x / eps), 5.0, 1.0) * (eps ^ 5.0)); elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = Float64(Float64(eps * eps) * fma(Float64(Float64(eps + x) * Float64(x * x)), 10.0, Float64(Float64(fma(5.0, x, eps) * eps) * eps))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], N[(N[(N[(x / eps), $MachinePrecision] * 5.0 + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(eps * eps), $MachinePrecision] * N[(N[(N[(eps + x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 10.0 + N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{\varepsilon}, 5, 1\right) \cdot {\varepsilon}^{5}\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(\left(\varepsilon + x\right) \cdot \left(x \cdot x\right), 10, \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317Initial program 97.7%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f64N/A
lower-/.f64N/A
lower-pow.f6489.4
Applied rewrites89.4%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
if 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.4%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6491.9
Applied rewrites91.9%
Taylor expanded in x around 0
Applied rewrites94.9%
Taylor expanded in eps around 0
Applied rewrites94.1%
Final simplification97.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1
(*
(* eps eps)
(fma (* (+ eps x) (* x x)) 10.0 (* (* (fma 5.0 x eps) eps) eps)))))
(if (<= t_0 -2e-317)
t_1
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = (eps * eps) * fma(((eps + x) * (x * x)), 10.0, ((fma(5.0, x, eps) * eps) * eps));
double tmp;
if (t_0 <= -2e-317) {
tmp = t_1;
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(eps * eps) * fma(Float64(Float64(eps + x) * Float64(x * x)), 10.0, Float64(Float64(fma(5.0, x, eps) * eps) * eps))) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_1; elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(eps * eps), $MachinePrecision] * N[(N[(N[(eps + x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 10.0 + N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$1, If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(\left(\varepsilon + x\right) \cdot \left(x \cdot x\right), 10, \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
Applied rewrites92.2%
Taylor expanded in eps around 0
Applied rewrites91.5%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1 (* (* (* eps eps) (* eps eps)) (fma 5.0 x eps))))
(if (<= t_0 -2e-317)
t_1
(if (<= t_0 5e-254)
(* (* (* x x) (fma (* 5.0 x) x (* (* eps x) 10.0))) eps)
t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = ((eps * eps) * (eps * eps)) * fma(5.0, x, eps);
double tmp;
if (t_0 <= -2e-317) {
tmp = t_1;
} else if (t_0 <= 5e-254) {
tmp = ((x * x) * fma((5.0 * x), x, ((eps * x) * 10.0))) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(eps * eps) * Float64(eps * eps)) * fma(5.0, x, eps)) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_1; elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(x * x) * fma(Float64(5.0 * x), x, Float64(Float64(eps * x) * 10.0))) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$1, If[LessEqual[t$95$0, 5e-254], N[(N[(N[(x * x), $MachinePrecision] * N[(N[(5.0 * x), $MachinePrecision] * x + N[(N[(eps * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \mathsf{fma}\left(5 \cdot x, x, \left(\varepsilon \cdot x\right) \cdot 10\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-pow.f6490.3
Applied rewrites90.3%
Applied rewrites89.9%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification97.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1 (* (* (* eps eps) (* eps eps)) (fma 5.0 x eps))))
(if (<= t_0 -2e-317)
t_1
(if (<= t_0 5e-254)
(* (* (* (* (fma 10.0 eps (* 5.0 x)) x) x) x) eps)
t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = ((eps * eps) * (eps * eps)) * fma(5.0, x, eps);
double tmp;
if (t_0 <= -2e-317) {
tmp = t_1;
} else if (t_0 <= 5e-254) {
tmp = (((fma(10.0, eps, (5.0 * x)) * x) * x) * x) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(eps * eps) * Float64(eps * eps)) * fma(5.0, x, eps)) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_1; elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * x) * x) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$1, If[LessEqual[t$95$0, 5e-254], N[(N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-pow.f6490.3
Applied rewrites90.3%
Applied rewrites89.9%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in eps around 0
Applied rewrites99.3%
Final simplification97.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1 (* (* (* eps eps) (* eps eps)) (fma 5.0 x eps))))
(if (<= t_0 -2e-317)
t_1
(if (<= t_0 5e-254) (* (* (* (* (* 5.0 x) x) x) x) eps) t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = ((eps * eps) * (eps * eps)) * fma(5.0, x, eps);
double tmp;
if (t_0 <= -2e-317) {
tmp = t_1;
} else if (t_0 <= 5e-254) {
tmp = ((((5.0 * x) * x) * x) * x) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(eps * eps) * Float64(eps * eps)) * fma(5.0, x, eps)) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_1; elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(Float64(Float64(5.0 * x) * x) * x) * x) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$1, If[LessEqual[t$95$0, 5e-254], N[(N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-pow.f6490.3
Applied rewrites90.3%
Applied rewrites89.9%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.0%
Final simplification97.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1 (* (* (* eps eps) (fma 5.0 x eps)) (* eps eps))))
(if (<= t_0 -2e-317)
t_1
(if (<= t_0 5e-254) (* (* (* (* (* 5.0 x) x) x) x) eps) t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = ((eps * eps) * fma(5.0, x, eps)) * (eps * eps);
double tmp;
if (t_0 <= -2e-317) {
tmp = t_1;
} else if (t_0 <= 5e-254) {
tmp = ((((5.0 * x) * x) * x) * x) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(eps * eps) * fma(5.0, x, eps)) * Float64(eps * eps)) tmp = 0.0 if (t_0 <= -2e-317) tmp = t_1; elseif (t_0 <= 5e-254) tmp = Float64(Float64(Float64(Float64(Float64(5.0 * x) * x) * x) * x) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(eps * eps), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-317], t$95$1, If[LessEqual[t$95$0, 5e-254], N[(N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;\left(\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.99999997e-317 or 5.0000000000000003e-254 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6490.6
Applied rewrites90.6%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
distribute-rgt-inN/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower-pow.f6490.3
Applied rewrites90.3%
Applied rewrites89.9%
if -1.99999997e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 5.0000000000000003e-254Initial program 90.1%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in x around 0
Applied rewrites99.3%
Taylor expanded in x around inf
Applied rewrites99.0%
Final simplification97.2%
(FPCore (x eps) :precision binary64 (* (* (* (* (* 5.0 x) x) x) x) eps))
double code(double x, double eps) {
return ((((5.0 * x) * x) * x) * x) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((((5.0d0 * x) * x) * x) * x) * eps
end function
public static double code(double x, double eps) {
return ((((5.0 * x) * x) * x) * x) * eps;
}
def code(x, eps): return ((((5.0 * x) * x) * x) * x) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(Float64(5.0 * x) * x) * x) * x) * eps) end
function tmp = code(x, eps) tmp = ((((5.0 * x) * x) * x) * x) * eps; end
code[x_, eps_] := N[(N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot x\right) \cdot x\right) \cdot \varepsilon
\end{array}
Initial program 91.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.7%
Taylor expanded in x around 0
Applied rewrites81.7%
Taylor expanded in x around inf
Applied rewrites80.9%
(FPCore (x eps) :precision binary64 (* (* (* (* (* eps eps) x) 10.0) x) eps))
double code(double x, double eps) {
return ((((eps * eps) * x) * 10.0) * x) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((((eps * eps) * x) * 10.0d0) * x) * eps
end function
public static double code(double x, double eps) {
return ((((eps * eps) * x) * 10.0) * x) * eps;
}
def code(x, eps): return ((((eps * eps) * x) * 10.0) * x) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(Float64(eps * eps) * x) * 10.0) * x) * eps) end
function tmp = code(x, eps) tmp = ((((eps * eps) * x) * 10.0) * x) * eps; end
code[x_, eps_] := N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * x), $MachinePrecision] * 10.0), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(\varepsilon \cdot \varepsilon\right) \cdot x\right) \cdot 10\right) \cdot x\right) \cdot \varepsilon
\end{array}
Initial program 91.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites81.7%
Taylor expanded in x around 0
Applied rewrites81.7%
Taylor expanded in x around 0
Applied rewrites72.5%
herbie shell --seed 2024331
(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)))