
(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 11 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)) (t_1 (- t_0 (pow x 5.0))))
(if (<= t_1 -4e-317)
t_1
(if (<= t_1 0.0)
(* (pow x 4.0) (- (* eps 5.0) (/ (* (* eps eps) -10.0) x)))
(- t_0 (* (* x x) (* x (* x x))))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double tmp;
if (t_1 <= -4e-317) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else {
tmp = t_0 - ((x * x) * (x * (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) :: t_1
real(8) :: tmp
t_0 = (x + eps) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
if (t_1 <= (-4d-317)) then
tmp = t_1
else if (t_1 <= 0.0d0) then
tmp = (x ** 4.0d0) * ((eps * 5.0d0) - (((eps * eps) * (-10.0d0)) / x))
else
tmp = t_0 - ((x * x) * (x * (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);
double t_1 = t_0 - Math.pow(x, 5.0);
double tmp;
if (t_1 <= -4e-317) {
tmp = t_1;
} else if (t_1 <= 0.0) {
tmp = Math.pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else {
tmp = t_0 - ((x * x) * (x * (x * x)));
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) t_1 = t_0 - math.pow(x, 5.0) tmp = 0 if t_1 <= -4e-317: tmp = t_1 elif t_1 <= 0.0: tmp = math.pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x)) else: tmp = t_0 - ((x * x) * (x * (x * x))) return tmp
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) tmp = 0.0 if (t_1 <= -4e-317) tmp = t_1; elseif (t_1 <= 0.0) tmp = Float64((x ^ 4.0) * Float64(Float64(eps * 5.0) - Float64(Float64(Float64(eps * eps) * -10.0) / x))); else tmp = Float64(t_0 - Float64(Float64(x * x) * Float64(x * Float64(x * x)))); end return tmp end
function tmp_2 = code(x, eps) t_0 = (x + eps) ^ 5.0; t_1 = t_0 - (x ^ 5.0); tmp = 0.0; if (t_1 <= -4e-317) tmp = t_1; elseif (t_1 <= 0.0) tmp = (x ^ 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x)); else tmp = t_0 - ((x * x) * (x * (x * x))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-317], t$95$1, If[LessEqual[t$95$1, 0.0], N[(N[Power[x, 4.0], $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] - N[(N[(N[(eps * eps), $MachinePrecision] * -10.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5 - \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot -10}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317Initial program 93.5%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in x around -inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
Simplified99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.2%
--lowering--.f64N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.3
Applied egg-rr99.3%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (- t_0 (* (* x x) (* x (* x x))))))
(if (<= t_1 -4e-317)
t_2
(if (<= t_1 0.0)
(* (pow x 4.0) (- (* eps 5.0) (/ (* (* eps eps) -10.0) x)))
t_2))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double t_2 = t_0 - ((x * x) * (x * (x * x)));
double tmp;
if (t_1 <= -4e-317) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (x + eps) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
t_2 = t_0 - ((x * x) * (x * (x * x)))
if (t_1 <= (-4d-317)) then
tmp = t_2
else if (t_1 <= 0.0d0) then
tmp = (x ** 4.0d0) * ((eps * 5.0d0) - (((eps * eps) * (-10.0d0)) / x))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0);
double t_1 = t_0 - Math.pow(x, 5.0);
double t_2 = t_0 - ((x * x) * (x * (x * x)));
double tmp;
if (t_1 <= -4e-317) {
tmp = t_2;
} else if (t_1 <= 0.0) {
tmp = Math.pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) t_1 = t_0 - math.pow(x, 5.0) t_2 = t_0 - ((x * x) * (x * (x * x))) tmp = 0 if t_1 <= -4e-317: tmp = t_2 elif t_1 <= 0.0: tmp = math.pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x)) else: tmp = t_2 return tmp
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(t_0 - Float64(Float64(x * x) * Float64(x * Float64(x * x)))) tmp = 0.0 if (t_1 <= -4e-317) tmp = t_2; elseif (t_1 <= 0.0) tmp = Float64((x ^ 4.0) * Float64(Float64(eps * 5.0) - Float64(Float64(Float64(eps * eps) * -10.0) / x))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, eps) t_0 = (x + eps) ^ 5.0; t_1 = t_0 - (x ^ 5.0); t_2 = t_0 - ((x * x) * (x * (x * x))); tmp = 0.0; if (t_1 <= -4e-317) tmp = t_2; elseif (t_1 <= 0.0) tmp = (x ^ 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[(N[(x * x), $MachinePrecision] * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-317], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[Power[x, 4.0], $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] - N[(N[(N[(eps * eps), $MachinePrecision] * -10.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := t\_0 - \left(x \cdot x\right) \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5 - \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot -10}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 96.4%
--lowering--.f64N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6496.3
Applied egg-rr96.3%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in x around -inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
Simplified99.9%
Final simplification99.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (* x (* x x)))
(t_3 (- t_0 (* (* x x) t_2))))
(if (<= t_1 -4e-317) t_3 (if (<= t_1 0.0) (* eps (* 5.0 (* x t_2))) t_3))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double t_2 = x * (x * x);
double t_3 = t_0 - ((x * x) * t_2);
double tmp;
if (t_1 <= -4e-317) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * (x * t_2));
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (x + eps) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
t_2 = x * (x * x)
t_3 = t_0 - ((x * x) * t_2)
if (t_1 <= (-4d-317)) then
tmp = t_3
else if (t_1 <= 0.0d0) then
tmp = eps * (5.0d0 * (x * t_2))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((x + eps), 5.0);
double t_1 = t_0 - Math.pow(x, 5.0);
double t_2 = x * (x * x);
double t_3 = t_0 - ((x * x) * t_2);
double tmp;
if (t_1 <= -4e-317) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = eps * (5.0 * (x * t_2));
} else {
tmp = t_3;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) t_1 = t_0 - math.pow(x, 5.0) t_2 = x * (x * x) t_3 = t_0 - ((x * x) * t_2) tmp = 0 if t_1 <= -4e-317: tmp = t_3 elif t_1 <= 0.0: tmp = eps * (5.0 * (x * t_2)) else: tmp = t_3 return tmp
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(x * Float64(x * x)) t_3 = Float64(t_0 - Float64(Float64(x * x) * t_2)) tmp = 0.0 if (t_1 <= -4e-317) tmp = t_3; elseif (t_1 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * t_2))); else tmp = t_3; end return tmp end
function tmp_2 = code(x, eps) t_0 = (x + eps) ^ 5.0; t_1 = t_0 - (x ^ 5.0); t_2 = x * (x * x); t_3 = t_0 - ((x * x) * t_2); tmp = 0.0; if (t_1 <= -4e-317) tmp = t_3; elseif (t_1 <= 0.0) tmp = eps * (5.0 * (x * t_2)); else tmp = t_3; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 - N[(N[(x * x), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e-317], t$95$3, If[LessEqual[t$95$1, 0.0], N[(eps * N[(5.0 * N[(x * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := x \cdot \left(x \cdot x\right)\\
t_3 := t\_0 - \left(x \cdot x\right) \cdot t\_2\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot t\_2\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 96.4%
--lowering--.f64N/A
pow-lowering-pow.f64N/A
+-lowering-+.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
*-lowering-*.f64N/A
cube-multN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6496.3
Applied egg-rr96.3%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
Final simplification99.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -4e-317)
(pow eps 5.0)
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -4e-317) {
tmp = pow(eps, 5.0);
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -4e-317) tmp = eps ^ 5.0; elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.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, -4e-317], N[Power[eps, 5.0], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317Initial program 93.5%
Taylor expanded in x around 0
pow-lowering-pow.f6488.4
Simplified88.4%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.2%
Taylor expanded in eps around inf
*-lowering-*.f64N/A
pow-lowering-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6496.0
Simplified96.0%
Final simplification98.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))) (t_1 (* eps (* eps eps))))
(if (<= t_0 -4e-317)
(* t_1 (fma eps (fma 5.0 x eps) (* x (* x 10.0))))
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(/ t_1 (/ 1.0 (fma eps (fma 5.0 x eps) (* (* x x) 10.0))))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = eps * (eps * eps);
double tmp;
if (t_0 <= -4e-317) {
tmp = t_1 * fma(eps, fma(5.0, x, eps), (x * (x * 10.0)));
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = t_1 / (1.0 / fma(eps, fma(5.0, x, eps), ((x * x) * 10.0)));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(eps * Float64(eps * eps)) tmp = 0.0 if (t_0 <= -4e-317) tmp = Float64(t_1 * fma(eps, fma(5.0, x, eps), Float64(x * Float64(x * 10.0)))); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(t_1 / Float64(1.0 / fma(eps, fma(5.0, x, eps), Float64(Float64(x * x) * 10.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[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-317], N[(t$95$1 * N[(eps * N[(5.0 * x + eps), $MachinePrecision] + N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 / N[(1.0 / N[(eps * N[(5.0 * x + eps), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;t\_1 \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(5, x, \varepsilon\right), x \cdot \left(x \cdot 10\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_1}{\frac{1}{\mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(5, x, \varepsilon\right), \left(x \cdot x\right) \cdot 10\right)}}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317Initial program 93.5%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified88.6%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6488.6
Simplified88.6%
Taylor expanded in x around 0
Simplified87.9%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.2%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified96.5%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6496.5
Simplified96.5%
Taylor expanded in x around 0
Simplified95.5%
flip3-+N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
Applied egg-rr95.5%
Final simplification98.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0)))
(t_1
(* (* eps (* eps eps)) (fma eps (fma 5.0 x eps) (* x (* x 10.0))))))
(if (<= t_0 -4e-317)
t_1
(if (<= t_0 0.0) (* eps (* 5.0 (* x (* x (* x x))))) t_1))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = (eps * (eps * eps)) * fma(eps, fma(5.0, x, eps), (x * (x * 10.0)));
double tmp;
if (t_0 <= -4e-317) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(eps * Float64(eps * eps)) * fma(eps, fma(5.0, x, eps), Float64(x * Float64(x * 10.0)))) tmp = 0.0 if (t_0 <= -4e-317) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = t_1; 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[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(5.0 * x + eps), $MachinePrecision] + N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-317], t$95$1, If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(5, x, \varepsilon\right), x \cdot \left(x \cdot 10\right)\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\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))) < -3.99999993e-317 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 96.4%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified92.6%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6492.6
Simplified92.6%
Taylor expanded in x around 0
Simplified91.8%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
Final simplification98.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))) (t_1 (* eps (* eps eps))))
(if (<= t_0 -4e-317)
(* (* eps eps) t_1)
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* (fma 5.0 x eps) (* eps t_1))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = eps * (eps * eps);
double tmp;
if (t_0 <= -4e-317) {
tmp = (eps * eps) * t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = fma(5.0, x, eps) * (eps * t_1);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(eps * Float64(eps * eps)) tmp = 0.0 if (t_0 <= -4e-317) tmp = Float64(Float64(eps * eps) * t_1); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(fma(5.0, x, eps) * Float64(eps * t_1)); 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[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-317], N[(N[(eps * eps), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * x + eps), $MachinePrecision] * N[(eps * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317Initial program 93.5%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified88.6%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.7
Applied egg-rr87.7%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.2%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified96.5%
Taylor expanded in x around 0
associate-*r*N/A
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f6495.4
Simplified95.4%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))) (t_1 (* eps (* eps eps))))
(if (<= t_0 -4e-317)
(* (* eps eps) t_1)
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* eps (* eps t_1))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double t_1 = eps * (eps * eps);
double tmp;
if (t_0 <= -4e-317) {
tmp = (eps * eps) * t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = eps * (eps * t_1);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
t_1 = eps * (eps * eps)
if (t_0 <= (-4d-317)) then
tmp = (eps * eps) * t_1
else if (t_0 <= 0.0d0) then
tmp = eps * (5.0d0 * (x * (x * (x * x))))
else
tmp = eps * (eps * t_1)
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 t_1 = eps * (eps * eps);
double tmp;
if (t_0 <= -4e-317) {
tmp = (eps * eps) * t_1;
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = eps * (eps * t_1);
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) t_1 = eps * (eps * eps) tmp = 0 if t_0 <= -4e-317: tmp = (eps * eps) * t_1 elif t_0 <= 0.0: tmp = eps * (5.0 * (x * (x * (x * x)))) else: tmp = eps * (eps * t_1) return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(eps * Float64(eps * eps)) tmp = 0.0 if (t_0 <= -4e-317) tmp = Float64(Float64(eps * eps) * t_1); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(eps * Float64(eps * t_1)); end return tmp end
function tmp_2 = code(x, eps) t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0); t_1 = eps * (eps * eps); tmp = 0.0; if (t_0 <= -4e-317) tmp = (eps * eps) * t_1; elseif (t_0 <= 0.0) tmp = eps * (5.0 * (x * (x * (x * x)))); else tmp = eps * (eps * t_1); 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]}, Block[{t$95$1 = N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-317], N[(N[(eps * eps), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(eps * N[(eps * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_1 := \varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-317}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot t\_1\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -3.99999993e-317Initial program 93.5%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified88.6%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6487.6
Simplified87.6%
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6487.7
Applied egg-rr87.7%
if -3.99999993e-317 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 85.1%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.9%
Taylor expanded in eps around 0
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6499.9
Simplified99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 99.2%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified96.5%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6493.9
Simplified93.9%
Final simplification98.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (* x (* x x)))))
(if (<= x -5.3e-43)
(* eps (* t_0 (fma eps (/ 10.0 x) 5.0)))
(if (<= x 1.2e-66)
(pow eps 5.0)
(* eps (fma 5.0 t_0 (* eps (* (+ x eps) (* (* x x) 10.0)))))))))
double code(double x, double eps) {
double t_0 = x * (x * (x * x));
double tmp;
if (x <= -5.3e-43) {
tmp = eps * (t_0 * fma(eps, (10.0 / x), 5.0));
} else if (x <= 1.2e-66) {
tmp = pow(eps, 5.0);
} else {
tmp = eps * fma(5.0, t_0, (eps * ((x + eps) * ((x * x) * 10.0))));
}
return tmp;
}
function code(x, eps) t_0 = Float64(x * Float64(x * Float64(x * x))) tmp = 0.0 if (x <= -5.3e-43) tmp = Float64(eps * Float64(t_0 * fma(eps, Float64(10.0 / x), 5.0))); elseif (x <= 1.2e-66) tmp = eps ^ 5.0; else tmp = Float64(eps * fma(5.0, t_0, Float64(eps * Float64(Float64(x + eps) * Float64(Float64(x * x) * 10.0))))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.3e-43], N[(eps * N[(t$95$0 * N[(eps * N[(10.0 / x), $MachinePrecision] + 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.2e-66], N[Power[eps, 5.0], $MachinePrecision], N[(eps * N[(5.0 * t$95$0 + N[(eps * N[(N[(x + eps), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{if}\;x \leq -5.3 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(t\_0 \cdot \mathsf{fma}\left(\varepsilon, \frac{10}{x}, 5\right)\right)\\
\mathbf{elif}\;x \leq 1.2 \cdot 10^{-66}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \mathsf{fma}\left(5, t\_0, \varepsilon \cdot \left(\left(x + \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right)\\
\end{array}
\end{array}
if x < -5.3000000000000003e-43Initial program 13.9%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified99.5%
Taylor expanded in x around inf
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
associate-*r/N/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6499.5
Simplified99.5%
if -5.3000000000000003e-43 < x < 1.20000000000000013e-66Initial program 100.0%
Taylor expanded in x around 0
pow-lowering-pow.f64100.0
Simplified100.0%
if 1.20000000000000013e-66 < x Initial program 58.4%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
Simplified89.3%
*-commutativeN/A
*-lowering-*.f64N/A
Applied egg-rr89.3%
Final simplification98.4%
(FPCore (x eps) :precision binary64 (* eps (* eps (* eps (* eps eps)))))
double code(double x, double eps) {
return eps * (eps * (eps * (eps * eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (eps * (eps * (eps * eps)))
end function
public static double code(double x, double eps) {
return eps * (eps * (eps * (eps * eps)));
}
def code(x, eps): return eps * (eps * (eps * (eps * eps)))
function code(x, eps) return Float64(eps * Float64(eps * Float64(eps * Float64(eps * eps)))) end
function tmp = code(x, eps) tmp = eps * (eps * (eps * (eps * eps))); end
code[x_, eps_] := N[(eps * N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)
\end{array}
Initial program 87.3%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified86.6%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6486.2
Simplified86.2%
Final simplification86.2%
(FPCore (x eps) :precision binary64 (* eps (* (* eps eps) (* eps eps))))
double code(double x, double eps) {
return eps * ((eps * eps) * (eps * eps));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * ((eps * eps) * (eps * eps))
end function
public static double code(double x, double eps) {
return eps * ((eps * eps) * (eps * eps));
}
def code(x, eps): return eps * ((eps * eps) * (eps * eps))
function code(x, eps) return Float64(eps * Float64(Float64(eps * eps) * Float64(eps * eps))) end
function tmp = code(x, eps) tmp = eps * ((eps * eps) * (eps * eps)); end
code[x_, eps_] := N[(eps * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)
\end{array}
Initial program 87.3%
Taylor expanded in x around 0
accelerator-lowering-fma.f64N/A
Simplified86.6%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
*-lowering-*.f64N/A
metadata-evalN/A
pow-plusN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6486.2
Simplified86.2%
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.2
Applied egg-rr86.2%
herbie shell --seed 2024198
(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)))