
(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 (* x (* x x))))
(if (<= x -3.5e-33)
(* t_0 (* eps (* x 5.0)))
(if (<= x 7.3e-44)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(* 5.0 (* eps (* x t_0)))))))
double code(double x, double eps) {
double t_0 = x * (x * x);
double tmp;
if (x <= -3.5e-33) {
tmp = t_0 * (eps * (x * 5.0));
} else if (x <= 7.3e-44) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = 5.0 * (eps * (x * t_0));
}
return tmp;
}
function code(x, eps) t_0 = Float64(x * Float64(x * x)) tmp = 0.0 if (x <= -3.5e-33) tmp = Float64(t_0 * Float64(eps * Float64(x * 5.0))); elseif (x <= 7.3e-44) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(5.0 * Float64(eps * Float64(x * t_0))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.5e-33], N[(t$95$0 * N[(eps * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.3e-44], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(5.0 * N[(eps * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0 \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\
\mathbf{elif}\;x \leq 7.3 \cdot 10^{-44}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot \left(x \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if x < -3.4999999999999999e-33Initial program 17.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.6
Simplified99.6%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.6
Applied egg-rr99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.7
Applied egg-rr99.7%
if -3.4999999999999999e-33 < x < 7.29999999999999987e-44Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
if 7.29999999999999987e-44 < x Initial program 55.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.7
Simplified99.7%
lift-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.8
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.9
Applied egg-rr99.9%
Final simplification100.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-318)
(* (fma 5.0 (/ x eps) 1.0) (* eps (* (* eps eps) (* eps eps))))
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* (* eps eps) (* eps (* eps eps)))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-318) {
tmp = fma(5.0, (x / eps), 1.0) * (eps * ((eps * eps) * (eps * eps)));
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = (eps * eps) * (eps * (eps * eps));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-318) tmp = Float64(fma(5.0, Float64(x / eps), 1.0) * Float64(eps * Float64(Float64(eps * eps) * Float64(eps * eps)))); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(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]}, If[LessEqual[t$95$0, -2e-318], N[(N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[(eps * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $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[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-318}:\\
\;\;\;\;\mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot \left(\varepsilon \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\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}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.0000024e-318Initial program 99.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.5
Simplified99.5%
if -2.0000024e-318 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 92.7%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64100.0
Simplified100.0%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64100.0
Applied egg-rr100.0%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.3
Simplified99.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.6
Applied egg-rr99.6%
Final simplification99.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-318)
(* (* (* eps eps) (* eps eps)) (fma 5.0 x eps))
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* (* eps eps) (* eps (* eps eps)))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-318) {
tmp = ((eps * eps) * (eps * eps)) * fma(5.0, x, eps);
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = (eps * eps) * (eps * (eps * eps));
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-318) tmp = Float64(Float64(Float64(eps * eps) * Float64(eps * eps)) * fma(5.0, x, eps)); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(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]}, If[LessEqual[t$95$0, -2e-318], N[(N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $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[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-318}:\\
\;\;\;\;\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\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}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.0000024e-318Initial program 99.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around 0
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6499.4
Simplified99.4%
if -2.0000024e-318 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 92.7%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64100.0
Simplified100.0%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64100.0
Applied egg-rr100.0%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.3
Simplified99.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.6
Applied egg-rr99.6%
Final simplification99.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-318)
(* eps (* (* eps eps) (* eps eps)))
(if (<= t_0 0.0)
(* eps (* 5.0 (* x (* x (* x x)))))
(* (* eps eps) (* eps (* eps eps)))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-318) {
tmp = eps * ((eps * eps) * (eps * eps));
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = (eps * eps) * (eps * (eps * eps));
}
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 <= (-2d-318)) then
tmp = eps * ((eps * eps) * (eps * eps))
else if (t_0 <= 0.0d0) then
tmp = eps * (5.0d0 * (x * (x * (x * x))))
else
tmp = (eps * eps) * (eps * (eps * eps))
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 <= -2e-318) {
tmp = eps * ((eps * eps) * (eps * eps));
} else if (t_0 <= 0.0) {
tmp = eps * (5.0 * (x * (x * (x * x))));
} else {
tmp = (eps * eps) * (eps * (eps * eps));
}
return tmp;
}
def code(x, eps): t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0) tmp = 0 if t_0 <= -2e-318: tmp = eps * ((eps * eps) * (eps * eps)) elif t_0 <= 0.0: tmp = eps * (5.0 * (x * (x * (x * x)))) else: tmp = (eps * eps) * (eps * (eps * eps)) return tmp
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-318) tmp = Float64(eps * Float64(Float64(eps * eps) * Float64(eps * eps))); elseif (t_0 <= 0.0) tmp = Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))); else tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(eps * eps))); 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 <= -2e-318) tmp = eps * ((eps * eps) * (eps * eps)); elseif (t_0 <= 0.0) tmp = eps * (5.0 * (x * (x * (x * x)))); else tmp = (eps * eps) * (eps * (eps * eps)); 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, -2e-318], N[(eps * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $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[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-318}:\\
\;\;\;\;\varepsilon \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\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}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.0000024e-318Initial program 99.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.9
Simplified98.9%
if -2.0000024e-318 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 92.7%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f64100.0
Simplified100.0%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64100.0
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f64100.0
Applied egg-rr100.0%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.3
Simplified99.3%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.6
Applied egg-rr99.6%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (* x x))))
(if (<= x -3.5e-33)
(* t_0 (* eps (* x 5.0)))
(if (<= x 6.7e-44) (pow eps 5.0) (* 5.0 (* eps (* x t_0)))))))
double code(double x, double eps) {
double t_0 = x * (x * x);
double tmp;
if (x <= -3.5e-33) {
tmp = t_0 * (eps * (x * 5.0));
} else if (x <= 6.7e-44) {
tmp = pow(eps, 5.0);
} else {
tmp = 5.0 * (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 = x * (x * x)
if (x <= (-3.5d-33)) then
tmp = t_0 * (eps * (x * 5.0d0))
else if (x <= 6.7d-44) then
tmp = eps ** 5.0d0
else
tmp = 5.0d0 * (eps * (x * t_0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (x * x);
double tmp;
if (x <= -3.5e-33) {
tmp = t_0 * (eps * (x * 5.0));
} else if (x <= 6.7e-44) {
tmp = Math.pow(eps, 5.0);
} else {
tmp = 5.0 * (eps * (x * t_0));
}
return tmp;
}
def code(x, eps): t_0 = x * (x * x) tmp = 0 if x <= -3.5e-33: tmp = t_0 * (eps * (x * 5.0)) elif x <= 6.7e-44: tmp = math.pow(eps, 5.0) else: tmp = 5.0 * (eps * (x * t_0)) return tmp
function code(x, eps) t_0 = Float64(x * Float64(x * x)) tmp = 0.0 if (x <= -3.5e-33) tmp = Float64(t_0 * Float64(eps * Float64(x * 5.0))); elseif (x <= 6.7e-44) tmp = eps ^ 5.0; else tmp = Float64(5.0 * Float64(eps * Float64(x * t_0))); end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (x * x); tmp = 0.0; if (x <= -3.5e-33) tmp = t_0 * (eps * (x * 5.0)); elseif (x <= 6.7e-44) tmp = eps ^ 5.0; else tmp = 5.0 * (eps * (x * t_0)); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.5e-33], N[(t$95$0 * N[(eps * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.7e-44], N[Power[eps, 5.0], $MachinePrecision], N[(5.0 * N[(eps * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0 \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\
\mathbf{elif}\;x \leq 6.7 \cdot 10^{-44}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot \left(x \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if x < -3.4999999999999999e-33Initial program 17.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.6
Simplified99.6%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.6
Applied egg-rr99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.7
Applied egg-rr99.7%
if -3.4999999999999999e-33 < x < 6.7000000000000002e-44Initial program 100.0%
Taylor expanded in x around 0
lower-pow.f6499.9
Simplified99.9%
if 6.7000000000000002e-44 < x Initial program 55.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.7
Simplified99.7%
lift-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.8
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.9
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* x (* x x))))
(if (<= x -3.5e-33)
(* t_0 (* eps (* x 5.0)))
(if (<= x 6.7e-44)
(* eps (* eps (* eps (* eps eps))))
(* 5.0 (* eps (* x t_0)))))))
double code(double x, double eps) {
double t_0 = x * (x * x);
double tmp;
if (x <= -3.5e-33) {
tmp = t_0 * (eps * (x * 5.0));
} else if (x <= 6.7e-44) {
tmp = eps * (eps * (eps * (eps * eps)));
} else {
tmp = 5.0 * (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 = x * (x * x)
if (x <= (-3.5d-33)) then
tmp = t_0 * (eps * (x * 5.0d0))
else if (x <= 6.7d-44) then
tmp = eps * (eps * (eps * (eps * eps)))
else
tmp = 5.0d0 * (eps * (x * t_0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = x * (x * x);
double tmp;
if (x <= -3.5e-33) {
tmp = t_0 * (eps * (x * 5.0));
} else if (x <= 6.7e-44) {
tmp = eps * (eps * (eps * (eps * eps)));
} else {
tmp = 5.0 * (eps * (x * t_0));
}
return tmp;
}
def code(x, eps): t_0 = x * (x * x) tmp = 0 if x <= -3.5e-33: tmp = t_0 * (eps * (x * 5.0)) elif x <= 6.7e-44: tmp = eps * (eps * (eps * (eps * eps))) else: tmp = 5.0 * (eps * (x * t_0)) return tmp
function code(x, eps) t_0 = Float64(x * Float64(x * x)) tmp = 0.0 if (x <= -3.5e-33) tmp = Float64(t_0 * Float64(eps * Float64(x * 5.0))); elseif (x <= 6.7e-44) tmp = Float64(eps * Float64(eps * Float64(eps * Float64(eps * eps)))); else tmp = Float64(5.0 * Float64(eps * Float64(x * t_0))); end return tmp end
function tmp_2 = code(x, eps) t_0 = x * (x * x); tmp = 0.0; if (x <= -3.5e-33) tmp = t_0 * (eps * (x * 5.0)); elseif (x <= 6.7e-44) tmp = eps * (eps * (eps * (eps * eps))); else tmp = 5.0 * (eps * (x * t_0)); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.5e-33], N[(t$95$0 * N[(eps * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6.7e-44], N[(eps * N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(5.0 * N[(eps * N[(x * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -3.5 \cdot 10^{-33}:\\
\;\;\;\;t\_0 \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\
\mathbf{elif}\;x \leq 6.7 \cdot 10^{-44}:\\
\;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot \left(x \cdot t\_0\right)\right)\\
\end{array}
\end{array}
if x < -3.4999999999999999e-33Initial program 17.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.6
Simplified99.6%
lift-pow.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.6
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.6
Applied egg-rr99.6%
lift-*.f64N/A
lift-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.7
Applied egg-rr99.7%
if -3.4999999999999999e-33 < x < 6.7000000000000002e-44Initial program 100.0%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f64100.0
Simplified100.0%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6499.8
Simplified99.8%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6499.8
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6499.8
Applied egg-rr99.8%
if 6.7000000000000002e-44 < x Initial program 55.8%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.7
Simplified99.7%
lift-pow.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6499.8
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-multN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
metadata-evalN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
lower-*.f6499.9
Applied egg-rr99.9%
Final simplification99.8%
(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 93.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6493.9
Simplified93.9%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.7
Simplified93.7%
lift-*.f64N/A
lift-*.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f6493.7
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lower-*.f6493.8
Applied egg-rr93.8%
Final simplification93.8%
(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 93.9%
Taylor expanded in eps around inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
lower-fma.f64N/A
lower-/.f6493.9
Simplified93.9%
Taylor expanded in eps around inf
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6493.7
Simplified93.7%
herbie shell --seed 2024207
(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)))