
(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 8 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))) (t_1 (* 2.0 (* x x))))
(if (<= t_0 -1e-321)
(+ (pow eps 5.0) (* x (* 5.0 (pow eps 4.0))))
(if (<= t_0 0.0) (fma (* eps t_1) t_1 (* eps (pow x 4.0))) t_0))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = 2.0 * (x * x);
double tmp;
if (t_0 <= -1e-321) {
tmp = pow(eps, 5.0) + (x * (5.0 * pow(eps, 4.0)));
} else if (t_0 <= 0.0) {
tmp = fma((eps * t_1), t_1, (eps * pow(x, 4.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(2.0 * Float64(x * x)) tmp = 0.0 if (t_0 <= -1e-321) tmp = Float64((eps ^ 5.0) + Float64(x * Float64(5.0 * (eps ^ 4.0)))); elseif (t_0 <= 0.0) tmp = fma(Float64(eps * t_1), t_1, Float64(eps * (x ^ 4.0))); else tmp = t_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]}, Block[{t$95$1 = N[(2.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-321], N[(N[Power[eps, 5.0], $MachinePrecision] + N[(x * N[(5.0 * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(eps * t$95$1), $MachinePrecision] * t$95$1 + N[(eps * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := 2 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;{\varepsilon}^{5} + x \cdot \left(5 \cdot {\varepsilon}^{4}\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon \cdot t_1, t_1, \varepsilon \cdot {x}^{4}\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -9.98013e-322Initial program 99.9%
Taylor expanded in x around 0 100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
Simplified100.0%
if -9.98013e-322 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 85.9%
Taylor expanded in x around inf 99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
associate-*l*99.9%
Simplified99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*l*99.9%
metadata-eval99.9%
distribute-lft1-in99.9%
distribute-lft-in99.9%
add-sqr-sqrt99.8%
associate-*r*99.9%
fma-def99.9%
sqrt-prod99.9%
metadata-eval99.9%
sqrt-pow199.9%
metadata-eval99.9%
pow299.9%
sqrt-prod99.9%
metadata-eval99.9%
sqrt-pow199.9%
metadata-eval99.9%
pow299.9%
Applied egg-rr99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 97.2%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (or (<= t_0 -1e-321) (not (<= t_0 0.0)))
t_0
(* x (* x (* eps (* 5.0 (* x x))))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if ((t_0 <= -1e-321) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = x * (x * (eps * (5.0 * (x * x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
if ((t_0 <= (-1d-321)) .or. (.not. (t_0 <= 0.0d0))) then
tmp = t_0
else
tmp = x * (x * (eps * (5.0d0 * (x * x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
double tmp;
if ((t_0 <= -1e-321) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = x * (x * (eps * (5.0 * (x * x))));
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if (t_0 <= -1e-321) or not (t_0 <= 0.0): tmp = t_0 else: tmp = x * (x * (eps * (5.0 * (x * x)))) return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if ((t_0 <= -1e-321) || !(t_0 <= 0.0)) tmp = t_0; else tmp = Float64(x * Float64(x * Float64(eps * Float64(5.0 * Float64(x * x))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if ((t_0 <= -1e-321) || ~((t_0 <= 0.0))) tmp = t_0; else tmp = x * (x * (eps * (5.0 * (x * x)))); end tmp_2 = 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, -1e-321], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(x * N[(x * N[(eps * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-321} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(x \cdot \left(\varepsilon \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -9.98013e-322 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 98.6%
if -9.98013e-322 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 85.9%
Taylor expanded in x around inf 99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
associate-*l*99.9%
Simplified99.9%
associate-*r*99.9%
*-commutative99.9%
add-sqr-sqrt92.3%
pow292.3%
sqrt-prod51.6%
*-commutative51.6%
sqrt-pow151.6%
metadata-eval51.6%
pow251.6%
Applied egg-rr51.6%
unpow251.6%
swap-sqr51.6%
add-sqr-sqrt99.8%
*-commutative99.8%
pow299.8%
pow299.8%
pow-prod-up99.9%
metadata-eval99.9%
associate-*r*99.9%
metadata-eval99.9%
pow-sqr99.8%
pow-prod-down99.8%
pow299.8%
associate-*l*99.9%
associate-*r*99.9%
associate-*r*99.9%
Applied egg-rr99.9%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -1e-321)
(+ (pow eps 5.0) (* x (* 5.0 (pow eps 4.0))))
(if (<= t_0 0.0) (* x (* x (* eps (* 5.0 (* x x))))) t_0))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -1e-321) {
tmp = pow(eps, 5.0) + (x * (5.0 * pow(eps, 4.0)));
} else if (t_0 <= 0.0) {
tmp = x * (x * (eps * (5.0 * (x * x))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
if (t_0 <= (-1d-321)) then
tmp = (eps ** 5.0d0) + (x * (5.0d0 * (eps ** 4.0d0)))
else if (t_0 <= 0.0d0) then
tmp = x * (x * (eps * (5.0d0 * (x * x))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
double tmp;
if (t_0 <= -1e-321) {
tmp = Math.pow(eps, 5.0) + (x * (5.0 * Math.pow(eps, 4.0)));
} else if (t_0 <= 0.0) {
tmp = x * (x * (eps * (5.0 * (x * x))));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if t_0 <= -1e-321: tmp = math.pow(eps, 5.0) + (x * (5.0 * math.pow(eps, 4.0))) elif t_0 <= 0.0: tmp = x * (x * (eps * (5.0 * (x * x)))) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -1e-321) tmp = Float64((eps ^ 5.0) + Float64(x * Float64(5.0 * (eps ^ 4.0)))); elseif (t_0 <= 0.0) tmp = Float64(x * Float64(x * Float64(eps * Float64(5.0 * Float64(x * x))))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if (t_0 <= -1e-321) tmp = (eps ^ 5.0) + (x * (5.0 * (eps ^ 4.0))); elseif (t_0 <= 0.0) tmp = x * (x * (eps * (5.0 * (x * x)))); else tmp = t_0; end tmp_2 = 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, -1e-321], N[(N[Power[eps, 5.0], $MachinePrecision] + N[(x * N[(5.0 * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(x * N[(x * N[(eps * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t_0 \leq -1 \cdot 10^{-321}:\\
\;\;\;\;{\varepsilon}^{5} + x \cdot \left(5 \cdot {\varepsilon}^{4}\right)\\
\mathbf{elif}\;t_0 \leq 0:\\
\;\;\;\;x \cdot \left(x \cdot \left(\varepsilon \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < -9.98013e-322Initial program 99.9%
Taylor expanded in x around 0 100.0%
distribute-lft1-in100.0%
metadata-eval100.0%
Simplified100.0%
if -9.98013e-322 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) < 0.0Initial program 85.9%
Taylor expanded in x around inf 99.9%
distribute-lft1-in99.9%
metadata-eval99.9%
associate-*l*99.9%
Simplified99.9%
associate-*r*99.9%
*-commutative99.9%
add-sqr-sqrt92.3%
pow292.3%
sqrt-prod51.6%
*-commutative51.6%
sqrt-pow151.6%
metadata-eval51.6%
pow251.6%
Applied egg-rr51.6%
unpow251.6%
swap-sqr51.6%
add-sqr-sqrt99.8%
*-commutative99.8%
pow299.8%
pow299.8%
pow-prod-up99.9%
metadata-eval99.9%
associate-*r*99.9%
metadata-eval99.9%
pow-sqr99.8%
pow-prod-down99.8%
pow299.8%
associate-*l*99.9%
associate-*r*99.9%
associate-*r*99.9%
Applied egg-rr99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) 5) (pow.f64 x 5)) Initial program 97.2%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* 5.0 (* x x))))
(if (<= x -1.5e-51)
(* t_0 (* eps (* x x)))
(if (<= x 1.35e-48) (pow eps 5.0) (* x (* eps (* x t_0)))))))
double code(double x, double eps) {
double t_0 = 5.0 * (x * x);
double tmp;
if (x <= -1.5e-51) {
tmp = t_0 * (eps * (x * x));
} else if (x <= 1.35e-48) {
tmp = pow(eps, 5.0);
} else {
tmp = x * (eps * (x * t_0));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = 5.0d0 * (x * x)
if (x <= (-1.5d-51)) then
tmp = t_0 * (eps * (x * x))
else if (x <= 1.35d-48) then
tmp = eps ** 5.0d0
else
tmp = x * (eps * (x * t_0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = 5.0 * (x * x);
double tmp;
if (x <= -1.5e-51) {
tmp = t_0 * (eps * (x * x));
} else if (x <= 1.35e-48) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = x * (eps * (x * t_0));
}
return tmp;
}
def code(x, eps): t_0 = 5.0 * (x * x) tmp = 0 if x <= -1.5e-51: tmp = t_0 * (eps * (x * x)) elif x <= 1.35e-48: tmp = math.pow(eps, 5.0) else: tmp = x * (eps * (x * t_0)) return tmp
function code(x, eps) t_0 = Float64(5.0 * Float64(x * x)) tmp = 0.0 if (x <= -1.5e-51) tmp = Float64(t_0 * Float64(eps * Float64(x * x))); elseif (x <= 1.35e-48) tmp = eps ^ 5.0; else tmp = Float64(x * Float64(eps * Float64(x * t_0))); end return tmp end
function tmp_2 = code(x, eps) t_0 = 5.0 * (x * x); tmp = 0.0; if (x <= -1.5e-51) tmp = t_0 * (eps * (x * x)); elseif (x <= 1.35e-48) tmp = eps ^ 5.0; else tmp = x * (eps * (x * t_0)); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e-51], N[(t$95$0 * N[(eps * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.35e-48], N[Power[eps, 5.0], $MachinePrecision], N[(x * N[(eps * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 5 \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{-51}:\\
\;\;\;\;t_0 \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-48}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\varepsilon \cdot \left(x \cdot t_0\right)\right)\\
\end{array}
\end{array}
if x < -1.50000000000000001e-51Initial program 35.8%
Taylor expanded in x around inf 95.1%
distribute-lft1-in95.1%
metadata-eval95.1%
associate-*l*94.9%
Simplified94.9%
associate-*r*95.1%
*-commutative95.1%
add-sqr-sqrt62.9%
pow262.9%
sqrt-prod58.7%
*-commutative58.7%
sqrt-pow158.7%
metadata-eval58.7%
pow258.7%
Applied egg-rr58.7%
unpow258.7%
swap-sqr58.9%
add-sqr-sqrt94.7%
*-commutative94.7%
pow294.7%
pow294.7%
pow-prod-up95.1%
metadata-eval95.1%
associate-*r*95.0%
metadata-eval95.0%
pow-sqr94.6%
pow-prod-down94.6%
pow294.6%
associate-*l*94.9%
*-commutative94.9%
associate-*r*95.1%
Applied egg-rr95.1%
if -1.50000000000000001e-51 < x < 1.35000000000000006e-48Initial program 100.0%
Taylor expanded in x around 0 100.0%
if 1.35000000000000006e-48 < x Initial program 21.9%
Taylor expanded in x around inf 99.3%
distribute-lft1-in99.3%
metadata-eval99.3%
associate-*l*99.4%
Simplified99.4%
associate-*r*99.3%
*-commutative99.3%
add-sqr-sqrt60.5%
pow260.5%
sqrt-prod49.3%
*-commutative49.3%
sqrt-pow149.4%
metadata-eval49.4%
pow249.4%
Applied egg-rr49.4%
unpow249.4%
swap-sqr49.5%
add-sqr-sqrt99.2%
*-commutative99.2%
pow299.2%
pow299.2%
pow-prod-up99.3%
metadata-eval99.3%
associate-*r*99.3%
metadata-eval99.3%
pow-sqr99.1%
pow-prod-down99.1%
pow299.1%
associate-*l*99.2%
associate-*r*99.2%
associate-*r*99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x eps) :precision binary64 (* eps (* (* x x) (* 5.0 (* x x)))))
double code(double x, double eps) {
return eps * ((x * x) * (5.0 * (x * x)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * ((x * x) * (5.0d0 * (x * x)))
end function
public static double code(double x, double eps) {
return eps * ((x * x) * (5.0 * (x * x)));
}
def code(x, eps): return eps * ((x * x) * (5.0 * (x * x)))
function code(x, eps) return Float64(eps * Float64(Float64(x * x) * Float64(5.0 * Float64(x * x)))) end
function tmp = code(x, eps) tmp = eps * ((x * x) * (5.0 * (x * x))); end
code[x_, eps_] := N[(eps * N[(N[(x * x), $MachinePrecision] * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)
\end{array}
Initial program 88.2%
Taylor expanded in eps around 0 83.4%
distribute-lft1-in83.4%
metadata-eval83.4%
sqr-pow83.3%
associate-*r*83.4%
metadata-eval83.4%
pow283.4%
metadata-eval83.4%
pow283.4%
Applied egg-rr83.4%
Final simplification83.4%
(FPCore (x eps) :precision binary64 (* eps (* x (* (* x x) (* x 5.0)))))
double code(double x, double eps) {
return eps * (x * ((x * x) * (x * 5.0)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (x * ((x * x) * (x * 5.0d0)))
end function
public static double code(double x, double eps) {
return eps * (x * ((x * x) * (x * 5.0)));
}
def code(x, eps): return eps * (x * ((x * x) * (x * 5.0)))
function code(x, eps) return Float64(eps * Float64(x * Float64(Float64(x * x) * Float64(x * 5.0)))) end
function tmp = code(x, eps) tmp = eps * (x * ((x * x) * (x * 5.0))); end
code[x_, eps_] := N[(eps * N[(x * N[(N[(x * x), $MachinePrecision] * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(x \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot 5\right)\right)\right)
\end{array}
Initial program 88.2%
Taylor expanded in eps around 0 83.4%
add-sqr-sqrt83.3%
sqrt-unprod81.6%
distribute-lft1-in81.6%
metadata-eval81.6%
distribute-lft1-in81.6%
metadata-eval81.6%
swap-sqr81.6%
metadata-eval81.6%
pow-prod-up81.6%
metadata-eval81.6%
Applied egg-rr81.6%
sqrt-prod81.6%
metadata-eval81.6%
sqrt-pow183.4%
metadata-eval83.4%
metadata-eval83.4%
pow-sqr83.3%
pow283.3%
pow283.3%
associate-*l*83.4%
*-commutative83.4%
associate-*r*83.4%
associate-*r*83.4%
Applied egg-rr83.4%
Final simplification83.4%
(FPCore (x eps) :precision binary64 (* (* 5.0 (* x x)) (* eps (* x x))))
double code(double x, double eps) {
return (5.0 * (x * x)) * (eps * (x * x));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (5.0d0 * (x * x)) * (eps * (x * x))
end function
public static double code(double x, double eps) {
return (5.0 * (x * x)) * (eps * (x * x));
}
def code(x, eps): return (5.0 * (x * x)) * (eps * (x * x))
function code(x, eps) return Float64(Float64(5.0 * Float64(x * x)) * Float64(eps * Float64(x * x))) end
function tmp = code(x, eps) tmp = (5.0 * (x * x)) * (eps * (x * x)); end
code[x_, eps_] := N[(N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 88.2%
Taylor expanded in x around inf 83.4%
distribute-lft1-in83.4%
metadata-eval83.4%
associate-*l*83.4%
Simplified83.4%
associate-*r*83.4%
*-commutative83.4%
add-sqr-sqrt77.1%
pow277.1%
sqrt-prod43.1%
*-commutative43.1%
sqrt-pow143.1%
metadata-eval43.1%
pow243.1%
Applied egg-rr43.1%
unpow243.1%
swap-sqr43.1%
add-sqr-sqrt83.3%
*-commutative83.3%
pow283.3%
pow283.3%
pow-prod-up83.4%
metadata-eval83.4%
associate-*r*83.4%
metadata-eval83.4%
pow-sqr83.3%
pow-prod-down83.3%
pow283.3%
associate-*l*83.4%
*-commutative83.4%
associate-*r*83.4%
Applied egg-rr83.4%
Final simplification83.4%
(FPCore (x eps) :precision binary64 (* x (* x (* eps (* 5.0 (* x x))))))
double code(double x, double eps) {
return x * (x * (eps * (5.0 * (x * x))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = x * (x * (eps * (5.0d0 * (x * x))))
end function
public static double code(double x, double eps) {
return x * (x * (eps * (5.0 * (x * x))));
}
def code(x, eps): return x * (x * (eps * (5.0 * (x * x))))
function code(x, eps) return Float64(x * Float64(x * Float64(eps * Float64(5.0 * Float64(x * x))))) end
function tmp = code(x, eps) tmp = x * (x * (eps * (5.0 * (x * x)))); end
code[x_, eps_] := N[(x * N[(x * N[(eps * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(x \cdot \left(\varepsilon \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\right)
\end{array}
Initial program 88.2%
Taylor expanded in x around inf 83.4%
distribute-lft1-in83.4%
metadata-eval83.4%
associate-*l*83.4%
Simplified83.4%
associate-*r*83.4%
*-commutative83.4%
add-sqr-sqrt77.1%
pow277.1%
sqrt-prod43.1%
*-commutative43.1%
sqrt-pow143.1%
metadata-eval43.1%
pow243.1%
Applied egg-rr43.1%
unpow243.1%
swap-sqr43.1%
add-sqr-sqrt83.3%
*-commutative83.3%
pow283.3%
pow283.3%
pow-prod-up83.4%
metadata-eval83.4%
associate-*r*83.4%
metadata-eval83.4%
pow-sqr83.3%
pow-prod-down83.3%
pow283.3%
associate-*l*83.4%
associate-*r*83.4%
associate-*r*83.4%
Applied egg-rr83.4%
Final simplification83.4%
herbie shell --seed 2023195
(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)))