
(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 (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
t_0
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = t_0;
} else {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = t_0; else tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], t$95$0, N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(*
(- (/ (fma 5.0 x (/ (* -10.0 (* x x)) (- eps))) eps) -1.0)
(pow eps 5.0))
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = ((fma(5.0, x, ((-10.0 * (x * x)) / -eps)) / eps) - -1.0) * pow(eps, 5.0);
} else {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(Float64(Float64(fma(5.0, x, Float64(Float64(-10.0 * Float64(x * x)) / Float64(-eps))) / eps) - -1.0) * (eps ^ 5.0)); else tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(N[(N[(5.0 * x + N[(N[(-10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(5, x, \frac{-10 \cdot \left(x \cdot x\right)}{-\varepsilon}\right)}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
Taylor expanded in eps around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.4%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -5e-279)
(*
(+
(fma (/ x (* eps eps)) (* 2.0 x) 1.0)
(/ (fma 5.0 x (/ (* (* x x) 8.0) eps)) eps))
(pow eps 5.0))
(if (<= t_0 2e-323)
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps)
(*
(- (/ (fma 5.0 x (/ (* -10.0 (* x x)) (- eps))) eps) -1.0)
(pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -5e-279) {
tmp = (fma((x / (eps * eps)), (2.0 * x), 1.0) + (fma(5.0, x, (((x * x) * 8.0) / eps)) / eps)) * pow(eps, 5.0);
} else if (t_0 <= 2e-323) {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
} else {
tmp = ((fma(5.0, x, ((-10.0 * (x * x)) / -eps)) / eps) - -1.0) * pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -5e-279) tmp = Float64(Float64(fma(Float64(x / Float64(eps * eps)), Float64(2.0 * x), 1.0) + Float64(fma(5.0, x, Float64(Float64(Float64(x * x) * 8.0) / eps)) / eps)) * (eps ^ 5.0)); elseif (t_0 <= 2e-323) tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); else tmp = Float64(Float64(Float64(fma(5.0, x, Float64(Float64(-10.0 * Float64(x * x)) / Float64(-eps))) / eps) - -1.0) * (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-279], N[(N[(N[(N[(x / N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(2.0 * x), $MachinePrecision] + 1.0), $MachinePrecision] + N[(N[(5.0 * x + N[(N[(N[(x * x), $MachinePrecision] * 8.0), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-323], N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(5.0 * x + N[(N[(-10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{x}{\varepsilon \cdot \varepsilon}, 2 \cdot x, 1\right) + \frac{\mathsf{fma}\left(5, x, \frac{\left(x \cdot x\right) \cdot 8}{\varepsilon}\right)}{\varepsilon}\right) \cdot {\varepsilon}^{5}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-323}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(5, x, \frac{-10 \cdot \left(x \cdot x\right)}{-\varepsilon}\right)}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279Initial program 98.2%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.8%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
if 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.7%
Taylor expanded in eps around -inf
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
lower-*.f64N/A
Applied rewrites94.2%
Final simplification98.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(* (* (* (fma (fma x 5.0 eps) eps (* (* 10.0 x) x)) eps) eps) eps)
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = ((fma(fma(x, 5.0, eps), eps, ((10.0 * x) * x)) * eps) * eps) * eps;
} else {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(Float64(Float64(fma(fma(x, 5.0, eps), eps, Float64(Float64(10.0 * x) * x)) * eps) * eps) * eps); else tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(N[(N[(N[(x * 5.0 + eps), $MachinePrecision] * eps + N[(N[(10.0 * x), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 5, \varepsilon\right), \varepsilon, \left(10 \cdot x\right) \cdot x\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.4%
Taylor expanded in eps around 0
Applied rewrites93.9%
Applied rewrites93.8%
Applied rewrites93.8%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
Final simplification98.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))) (t_1 (* (* 10.0 x) x)))
(if (<= t_0 -5e-279)
(* (fma (fma 5.0 x eps) eps t_1) (pow eps 3.0))
(if (<= t_0 2e-323)
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps)
(* (* (* (fma (fma x 5.0 eps) eps t_1) eps) eps) eps)))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = (10.0 * x) * x;
double tmp;
if (t_0 <= -5e-279) {
tmp = fma(fma(5.0, x, eps), eps, t_1) * pow(eps, 3.0);
} else if (t_0 <= 2e-323) {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
} else {
tmp = ((fma(fma(x, 5.0, eps), eps, t_1) * eps) * eps) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(10.0 * x) * x) tmp = 0.0 if (t_0 <= -5e-279) tmp = Float64(fma(fma(5.0, x, eps), eps, t_1) * (eps ^ 3.0)); elseif (t_0 <= 2e-323) tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); else tmp = Float64(Float64(Float64(fma(fma(x, 5.0, eps), eps, t_1) * eps) * eps) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(10.0 * x), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t$95$0, -5e-279], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + t$95$1), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e-323], N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(N[(x * 5.0 + eps), $MachinePrecision] * eps + t$95$1), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \left(10 \cdot x\right) \cdot x\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_1\right) \cdot {\varepsilon}^{3}\\
\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-323}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(\mathsf{fma}\left(x, 5, \varepsilon\right), \varepsilon, t\_1\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279Initial program 98.2%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.8%
Taylor expanded in eps around 0
Applied rewrites94.4%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
if 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.7%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites94.2%
Taylor expanded in eps around 0
Applied rewrites93.6%
Applied rewrites93.5%
Applied rewrites93.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(* (* (* (* (fma x 5.0 eps) eps) eps) eps) eps)
(* (* (* (fma 10.0 eps (* 5.0 x)) x) (* x x)) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = (((fma(x, 5.0, eps) * eps) * eps) * eps) * eps;
} else {
tmp = ((fma(10.0, eps, (5.0 * x)) * x) * (x * x)) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(Float64(Float64(Float64(fma(x, 5.0, eps) * eps) * eps) * eps) * eps); else tmp = Float64(Float64(Float64(fma(10.0, eps, Float64(5.0 * x)) * x) * Float64(x * x)) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(N[(N[(N[(x * 5.0 + eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(10.0 * eps + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\left(\left(\left(\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(10, \varepsilon, 5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
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.f6492.9
Applied rewrites92.9%
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.f6492.5
Applied rewrites92.5%
Applied rewrites92.1%
Applied rewrites92.2%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
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 eps around 0
Applied rewrites99.9%
Final simplification98.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(* (* (* (* (fma x 5.0 eps) eps) eps) eps) eps)
(* (* (* (* (* x x) 5.0) x) x) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = (((fma(x, 5.0, eps) * eps) * eps) * eps) * eps;
} else {
tmp = ((((x * x) * 5.0) * x) * x) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(Float64(Float64(Float64(fma(x, 5.0, eps) * eps) * eps) * eps) * eps); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 5.0) * x) * x) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(N[(N[(N[(x * 5.0 + eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\left(\left(\left(\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
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.f6492.9
Applied rewrites92.9%
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.f6492.5
Applied rewrites92.5%
Applied rewrites92.1%
Applied rewrites92.2%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
Final simplification98.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(* (fma 5.0 x eps) (* (* eps eps) (* eps eps)))
(* (* (* (* (* x x) 5.0) x) x) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = fma(5.0, x, eps) * ((eps * eps) * (eps * eps));
} else {
tmp = ((((x * x) * 5.0) * x) * x) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(fma(5.0, x, eps) * Float64(Float64(eps * eps) * Float64(eps * eps))); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 5.0) * x) * x) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(5.0 * x + eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
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.f6492.9
Applied rewrites92.9%
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.f6492.5
Applied rewrites92.5%
Applied rewrites92.2%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
Final simplification98.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -5e-279) (not (<= t_0 2e-323)))
(* (* (fma 5.0 x eps) (* eps eps)) (* eps eps))
(* (* (* (* (* x x) 5.0) x) x) eps))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) {
tmp = (fma(5.0, x, eps) * (eps * eps)) * (eps * eps);
} else {
tmp = ((((x * x) * 5.0) * x) * x) * eps;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -5e-279) || !(t_0 <= 2e-323)) tmp = Float64(Float64(fma(5.0, x, eps) * Float64(eps * eps)) * Float64(eps * eps)); else tmp = Float64(Float64(Float64(Float64(Float64(x * x) * 5.0) * x) * x) * eps); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -5e-279], N[Not[LessEqual[t$95$0, 2e-323]], $MachinePrecision]], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -5 \cdot 10^{-279} \lor \neg \left(t\_0 \leq 2 \cdot 10^{-323}\right):\\
\;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot x\right) \cdot x\right) \cdot \varepsilon\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -4.99999999999999969e-279 or 1.97626e-323 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.5%
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.f6492.9
Applied rewrites92.9%
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.f6492.5
Applied rewrites92.5%
Applied rewrites92.1%
if -4.99999999999999969e-279 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 1.97626e-323Initial program 88.9%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Applied rewrites99.9%
Taylor expanded in x around inf
Applied rewrites99.9%
Final simplification98.4%
(FPCore (x eps) :precision binary64 (* (* (* (* (* x x) 5.0) x) x) eps))
double code(double x, double eps) {
return ((((x * x) * 5.0) * x) * x) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((((x * x) * 5.0d0) * x) * x) * eps
end function
public static double code(double x, double eps) {
return ((((x * x) * 5.0) * x) * x) * eps;
}
def code(x, eps): return ((((x * x) * 5.0) * x) * x) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(Float64(x * x) * 5.0) * x) * x) * eps) end
function tmp = code(x, eps) tmp = ((((x * x) * 5.0) * x) * x) * eps; end
code[x_, eps_] := N[(N[(N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot x\right) \cdot 5\right) \cdot x\right) \cdot x\right) \cdot \varepsilon
\end{array}
Initial program 90.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.7%
Taylor expanded in x around 0
Applied rewrites82.6%
Applied rewrites82.6%
Taylor expanded in x around inf
Applied rewrites82.2%
Final simplification82.2%
(FPCore (x eps) :precision binary64 (* (* 10.0 (* (* (* x x) eps) eps)) eps))
double code(double x, double eps) {
return (10.0 * (((x * x) * eps) * eps)) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (10.0d0 * (((x * x) * eps) * eps)) * eps
end function
public static double code(double x, double eps) {
return (10.0 * (((x * x) * eps) * eps)) * eps;
}
def code(x, eps): return (10.0 * (((x * x) * eps) * eps)) * eps
function code(x, eps) return Float64(Float64(10.0 * Float64(Float64(Float64(x * x) * eps) * eps)) * eps) end
function tmp = code(x, eps) tmp = (10.0 * (((x * x) * eps) * eps)) * eps; end
code[x_, eps_] := N[(N[(10.0 * N[(N[(N[(x * x), $MachinePrecision] * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(10 \cdot \left(\left(\left(x \cdot x\right) \cdot \varepsilon\right) \cdot \varepsilon\right)\right) \cdot \varepsilon
\end{array}
Initial program 90.7%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites82.7%
Taylor expanded in x around 0
Applied rewrites73.1%
Applied rewrites73.1%
(FPCore (x eps) :precision binary64 (* (* (* (* eps x) 5.0) eps) (* eps eps)))
double code(double x, double eps) {
return (((eps * x) * 5.0) * eps) * (eps * eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((eps * x) * 5.0d0) * eps) * (eps * eps)
end function
public static double code(double x, double eps) {
return (((eps * x) * 5.0) * eps) * (eps * eps);
}
def code(x, eps): return (((eps * x) * 5.0) * eps) * (eps * eps)
function code(x, eps) return Float64(Float64(Float64(Float64(eps * x) * 5.0) * eps) * Float64(eps * eps)) end
function tmp = code(x, eps) tmp = (((eps * x) * 5.0) * eps) * (eps * eps); end
code[x_, eps_] := N[(N[(N[(N[(eps * x), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\varepsilon \cdot x\right) \cdot 5\right) \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)
\end{array}
Initial program 90.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.6
Applied rewrites89.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.f6489.6
Applied rewrites89.6%
Applied rewrites89.5%
Taylor expanded in x around inf
Applied rewrites73.0%
herbie shell --seed 2024337
(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)))