
(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 17 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
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 1.15e-45)
(- (pow (+ x eps) 5.0) (pow x 5.0))
(*
eps
(fma
eps
(fma eps (fma eps (* x 5.0) (* (* x x) 10.0)) (* 10.0 (* x (* x x))))
(* 5.0 (pow x 4.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 1.15e-45) {
tmp = pow((x + eps), 5.0) - pow(x, 5.0);
} else {
tmp = eps * fma(eps, fma(eps, fma(eps, (x * 5.0), ((x * x) * 10.0)), (10.0 * (x * (x * x)))), (5.0 * pow(x, 4.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 1.15e-45) tmp = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)); else tmp = Float64(eps * fma(eps, fma(eps, fma(eps, Float64(x * 5.0), Float64(Float64(x * x) * 10.0)), Float64(10.0 * Float64(x * Float64(x * x)))), Float64(5.0 * (x ^ 4.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.15e-45], N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], N[(eps * N[(eps * N[(eps * N[(eps * N[(x * 5.0), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] + N[(10.0 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 1.15 \cdot 10^{-45}:\\
\;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, x \cdot 5, \left(x \cdot x\right) \cdot 10\right), 10 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 5 \cdot {x}^{4}\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 1.14999999999999996e-45Initial program 100.0%
if 1.14999999999999996e-45 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 5.7e-46)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(*
eps
(fma
eps
(fma eps (fma eps (* x 5.0) (* (* x x) 10.0)) (* 10.0 (* x (* x x))))
(* 5.0 (pow x 4.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 5.7e-46) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = eps * fma(eps, fma(eps, fma(eps, (x * 5.0), ((x * x) * 10.0)), (10.0 * (x * (x * x)))), (5.0 * pow(x, 4.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 5.7e-46) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(eps * fma(eps, fma(eps, fma(eps, Float64(x * 5.0), Float64(Float64(x * x) * 10.0)), Float64(10.0 * Float64(x * Float64(x * x)))), Float64(5.0 * (x ^ 4.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(eps * N[(eps * N[(eps * N[(eps * N[(x * 5.0), $MachinePrecision] + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] + N[(10.0 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(\varepsilon, x \cdot 5, \left(x \cdot x\right) \cdot 10\right), 10 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), 5 \cdot {x}^{4}\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 5.7e-46)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(*
x
(fma
5.0
(pow eps 4.0)
(* x (* eps (fma 5.0 (* x x) (* 10.0 (* eps (+ x eps)))))))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 5.7e-46) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = x * fma(5.0, pow(eps, 4.0), (x * (eps * fma(5.0, (x * x), (10.0 * (eps * (x + eps)))))));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 5.7e-46) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(x * fma(5.0, (eps ^ 4.0), Float64(x * Float64(eps * fma(5.0, Float64(x * x), Float64(10.0 * Float64(eps * Float64(x + eps)))))))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(5.0 * N[Power[eps, 4.0], $MachinePrecision] + N[(x * N[(eps * N[(5.0 * N[(x * x), $MachinePrecision] + N[(10.0 * N[(eps * N[(x + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{fma}\left(5, {\varepsilon}^{4}, x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(5, x \cdot x, 10 \cdot \left(\varepsilon \cdot \left(x + \varepsilon\right)\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Taylor expanded in x around 0
Applied rewrites36.1%
Taylor expanded in x around 0
Applied rewrites94.5%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 5.7e-46)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(*
eps
(*
x
(fma
(* eps eps)
(fma eps 5.0 (* x 10.0))
(* x (* x (fma eps 10.0 (* x 5.0))))))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 5.7e-46) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = eps * (x * fma((eps * eps), fma(eps, 5.0, (x * 10.0)), (x * (x * fma(eps, 10.0, (x * 5.0))))));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 5.7e-46) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(eps * Float64(x * fma(Float64(eps * eps), fma(eps, 5.0, Float64(x * 10.0)), Float64(x * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(eps * N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(eps * 5.0 + N[(x * 10.0), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(\varepsilon, 5, x \cdot 10\right), x \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Taylor expanded in x around 0
Applied rewrites94.4%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 5.7e-46)
(* (pow eps 4.0) (fma 5.0 x eps))
(*
eps
(*
x
(fma
(* eps eps)
(fma eps 5.0 (* x 10.0))
(* x (* x (fma eps 10.0 (* x 5.0))))))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 5.7e-46) {
tmp = pow(eps, 4.0) * fma(5.0, x, eps);
} else {
tmp = eps * (x * fma((eps * eps), fma(eps, 5.0, (x * 10.0)), (x * (x * fma(eps, 10.0, (x * 5.0))))));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 5.7e-46) tmp = Float64((eps ^ 4.0) * fma(5.0, x, eps)); else tmp = Float64(eps * Float64(x * fma(Float64(eps * eps), fma(eps, 5.0, Float64(x * 10.0)), Float64(x * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[Power[eps, 4.0], $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision], N[(eps * N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(eps * 5.0 + N[(x * 10.0), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;{\varepsilon}^{4} \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(\varepsilon, 5, x \cdot 10\right), x \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Taylor expanded in x around 0
Applied rewrites94.4%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* eps (* eps eps)))))
(if (<= x -2.7e-42)
(* (pow x 4.0) (* eps 5.0))
(if (<= x 5.7e-46)
(fma (* x t_0) 5.0 (* eps t_0))
(*
eps
(*
x
(fma
(* eps eps)
(fma eps 5.0 (* x 10.0))
(* x (* x (fma eps 10.0 (* x 5.0)))))))))))
double code(double x, double eps) {
double t_0 = eps * (eps * (eps * eps));
double tmp;
if (x <= -2.7e-42) {
tmp = pow(x, 4.0) * (eps * 5.0);
} else if (x <= 5.7e-46) {
tmp = fma((x * t_0), 5.0, (eps * t_0));
} else {
tmp = eps * (x * fma((eps * eps), fma(eps, 5.0, (x * 10.0)), (x * (x * fma(eps, 10.0, (x * 5.0))))));
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64(eps * Float64(eps * eps))) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64((x ^ 4.0) * Float64(eps * 5.0)); elseif (x <= 5.7e-46) tmp = fma(Float64(x * t_0), 5.0, Float64(eps * t_0)); else tmp = Float64(eps * Float64(x * fma(Float64(eps * eps), fma(eps, 5.0, Float64(x * 10.0)), Float64(x * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[(x * t$95$0), $MachinePrecision] * 5.0 + N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision], N[(eps * N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(eps * 5.0 + N[(x * 10.0), $MachinePrecision]), $MachinePrecision] + N[(x * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot t\_0, 5, \varepsilon \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(\varepsilon, 5, x \cdot 10\right), x \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Taylor expanded in x around 0
Applied rewrites94.4%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* eps (* eps eps)))) (t_1 (* x (fma eps 10.0 (* x 5.0)))))
(if (<= x -2.7e-42)
(* (* x x) (* eps t_1))
(if (<= x 5.7e-46)
(fma (* x t_0) 5.0 (* eps t_0))
(* eps (* x (fma (* eps eps) (fma eps 5.0 (* x 10.0)) (* x t_1))))))))
double code(double x, double eps) {
double t_0 = eps * (eps * (eps * eps));
double t_1 = x * fma(eps, 10.0, (x * 5.0));
double tmp;
if (x <= -2.7e-42) {
tmp = (x * x) * (eps * t_1);
} else if (x <= 5.7e-46) {
tmp = fma((x * t_0), 5.0, (eps * t_0));
} else {
tmp = eps * (x * fma((eps * eps), fma(eps, 5.0, (x * 10.0)), (x * t_1)));
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64(eps * Float64(eps * eps))) t_1 = Float64(x * fma(eps, 10.0, Float64(x * 5.0))) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64(Float64(x * x) * Float64(eps * t_1)); elseif (x <= 5.7e-46) tmp = fma(Float64(x * t_0), 5.0, Float64(eps * t_0)); else tmp = Float64(eps * Float64(x * fma(Float64(eps * eps), fma(eps, 5.0, Float64(x * 10.0)), Float64(x * t_1)))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], N[(N[(x * x), $MachinePrecision] * N[(eps * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[(x * t$95$0), $MachinePrecision] * 5.0 + N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision], N[(eps * N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(eps * 5.0 + N[(x * 10.0), $MachinePrecision]), $MachinePrecision] + N[(x * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
t_1 := x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\varepsilon \cdot t\_1\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot t\_0, 5, \varepsilon \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(\varepsilon, 5, x \cdot 10\right), x \cdot t\_1\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in eps around 0
Applied rewrites94.6%
Taylor expanded in x around 0
Applied rewrites94.4%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* eps (* eps eps)))))
(if (<= x -2.7e-42)
(* (* x x) (* eps (* x (fma eps 10.0 (* x 5.0)))))
(if (<= x 5.7e-46)
(fma (* x t_0) 5.0 (* eps t_0))
(* (fma 10.0 (/ (* eps eps) x) (* eps 5.0)) (* x (* x (* x x))))))))
double code(double x, double eps) {
double t_0 = eps * (eps * (eps * eps));
double tmp;
if (x <= -2.7e-42) {
tmp = (x * x) * (eps * (x * fma(eps, 10.0, (x * 5.0))));
} else if (x <= 5.7e-46) {
tmp = fma((x * t_0), 5.0, (eps * t_0));
} else {
tmp = fma(10.0, ((eps * eps) / x), (eps * 5.0)) * (x * (x * (x * x)));
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64(eps * Float64(eps * eps))) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64(Float64(x * x) * Float64(eps * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))); elseif (x <= 5.7e-46) tmp = fma(Float64(x * t_0), 5.0, Float64(eps * t_0)); else tmp = Float64(fma(10.0, Float64(Float64(eps * eps) / x), Float64(eps * 5.0)) * Float64(x * Float64(x * Float64(x * x)))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], N[(N[(x * x), $MachinePrecision] * N[(eps * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[(x * t$95$0), $MachinePrecision] * 5.0 + N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(10.0 * N[(N[(eps * eps), $MachinePrecision] / x), $MachinePrecision] + N[(eps * 5.0), $MachinePrecision]), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot t\_0, 5, \varepsilon \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(10, \frac{\varepsilon \cdot \varepsilon}{x}, \varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites99.6%
Applied rewrites99.6%
Taylor expanded in eps around 0
Applied rewrites99.6%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites92.1%
Applied rewrites92.1%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* eps (* eps eps))))
(t_1 (* (* x x) (* eps (* x (fma eps 10.0 (* x 5.0)))))))
(if (<= x -2.7e-42)
t_1
(if (<= x 5.7e-46) (fma (* x t_0) 5.0 (* eps t_0)) t_1))))
double code(double x, double eps) {
double t_0 = eps * (eps * (eps * eps));
double t_1 = (x * x) * (eps * (x * fma(eps, 10.0, (x * 5.0))));
double tmp;
if (x <= -2.7e-42) {
tmp = t_1;
} else if (x <= 5.7e-46) {
tmp = fma((x * t_0), 5.0, (eps * t_0));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64(eps * Float64(eps * eps))) t_1 = Float64(Float64(x * x) * Float64(eps * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))) tmp = 0.0 if (x <= -2.7e-42) tmp = t_1; elseif (x <= 5.7e-46) tmp = fma(Float64(x * t_0), 5.0, Float64(eps * t_0)); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] * N[(eps * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], t$95$1, If[LessEqual[x, 5.7e-46], N[(N[(x * t$95$0), $MachinePrecision] * 5.0 + N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
t_1 := \left(x \cdot x\right) \cdot \left(\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot t\_0, 5, \varepsilon \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42 or 5.7000000000000003e-46 < x Initial program 35.2%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites96.4%
Applied rewrites96.2%
Taylor expanded in eps around 0
Applied rewrites96.3%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* x x) (* eps (* x (fma eps 10.0 (* x 5.0)))))))
(if (<= x -2.7e-42)
t_0
(if (<= x 5.7e-46) (* (* eps (* eps (* eps eps))) (fma x 5.0 eps)) t_0))))
double code(double x, double eps) {
double t_0 = (x * x) * (eps * (x * fma(eps, 10.0, (x * 5.0))));
double tmp;
if (x <= -2.7e-42) {
tmp = t_0;
} else if (x <= 5.7e-46) {
tmp = (eps * (eps * (eps * eps))) * fma(x, 5.0, eps);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(x * x) * Float64(eps * Float64(x * fma(eps, 10.0, Float64(x * 5.0))))) tmp = 0.0 if (x <= -2.7e-42) tmp = t_0; elseif (x <= 5.7e-46) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(x, 5.0, eps)); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * N[(eps * N[(x * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], t$95$0, If[LessEqual[x, 5.7e-46], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * 5.0 + eps), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot \left(\varepsilon \cdot \left(x \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(x, 5, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42 or 5.7000000000000003e-46 < x Initial program 35.2%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites96.4%
Applied rewrites96.2%
Taylor expanded in eps around 0
Applied rewrites96.3%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification99.2%
(FPCore (x eps)
:precision binary64
(if (<= x -2.7e-42)
(* (* eps 5.0) (* x (* x (* x x))))
(if (<= x 5.7e-46)
(* (* eps (* eps (* eps eps))) (fma x 5.0 eps))
(* (* x x) (* x (* eps (fma eps 10.0 (* x 5.0))))))))
double code(double x, double eps) {
double tmp;
if (x <= -2.7e-42) {
tmp = (eps * 5.0) * (x * (x * (x * x)));
} else if (x <= 5.7e-46) {
tmp = (eps * (eps * (eps * eps))) * fma(x, 5.0, eps);
} else {
tmp = (x * x) * (x * (eps * fma(eps, 10.0, (x * 5.0))));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -2.7e-42) tmp = Float64(Float64(eps * 5.0) * Float64(x * Float64(x * Float64(x * x)))); elseif (x <= 5.7e-46) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(x, 5.0, eps)); else tmp = Float64(Float64(x * x) * Float64(x * Float64(eps * fma(eps, 10.0, Float64(x * 5.0))))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -2.7e-42], N[(N[(eps * 5.0), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.7e-46], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * 5.0 + eps), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(x * N[(eps * N[(eps * 10.0 + N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(x, 5, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\right)\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42Initial program 25.0%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.5
Applied rewrites99.5%
Applied rewrites99.5%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
if 5.7000000000000003e-46 < x Initial program 48.7%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites92.1%
Taylor expanded in x around 0
Applied rewrites91.8%
Final simplification99.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* eps 5.0) (* x (* x (* x x))))))
(if (<= x -2.7e-42)
t_0
(if (<= x 5.7e-46) (* (* eps (* eps (* eps eps))) (fma x 5.0 eps)) t_0))))
double code(double x, double eps) {
double t_0 = (eps * 5.0) * (x * (x * (x * x)));
double tmp;
if (x <= -2.7e-42) {
tmp = t_0;
} else if (x <= 5.7e-46) {
tmp = (eps * (eps * (eps * eps))) * fma(x, 5.0, eps);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(eps * 5.0) * Float64(x * Float64(x * Float64(x * x)))) tmp = 0.0 if (x <= -2.7e-42) tmp = t_0; elseif (x <= 5.7e-46) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(x, 5.0, eps)); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(eps * 5.0), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], t$95$0, If[LessEqual[x, 5.7e-46], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x * 5.0 + eps), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(x, 5, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42 or 5.7000000000000003e-46 < x Initial program 35.2%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6494.9
Applied rewrites94.9%
Applied rewrites94.8%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification99.0%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* eps 5.0) (* x (* x (* x x))))))
(if (<= x -2.7e-42)
t_0
(if (<= x 5.7e-46) (* (* eps (* eps eps)) (* eps (fma x 5.0 eps))) t_0))))
double code(double x, double eps) {
double t_0 = (eps * 5.0) * (x * (x * (x * x)));
double tmp;
if (x <= -2.7e-42) {
tmp = t_0;
} else if (x <= 5.7e-46) {
tmp = (eps * (eps * eps)) * (eps * fma(x, 5.0, eps));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(eps * 5.0) * Float64(x * Float64(x * Float64(x * x)))) tmp = 0.0 if (x <= -2.7e-42) tmp = t_0; elseif (x <= 5.7e-46) tmp = Float64(Float64(eps * Float64(eps * eps)) * Float64(eps * fma(x, 5.0, eps))); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(eps * 5.0), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.7e-42], t$95$0, If[LessEqual[x, 5.7e-46], N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(x * 5.0 + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{if}\;x \leq -2.7 \cdot 10^{-42}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.7 \cdot 10^{-46}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, 5, \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2.69999999999999999e-42 or 5.7000000000000003e-46 < x Initial program 35.2%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6494.9
Applied rewrites94.9%
Applied rewrites94.8%
if -2.69999999999999999e-42 < x < 5.7000000000000003e-46Initial 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
Applied rewrites100.0%
Taylor expanded in x around 0
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
metadata-evalN/A
pow-plusN/A
distribute-lft-inN/A
+-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites99.8%
Final simplification98.9%
(FPCore (x eps) :precision binary64 (* (* eps 5.0) (* x (* x (* x x)))))
double code(double x, double eps) {
return (eps * 5.0) * (x * (x * (x * x)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (eps * 5.0d0) * (x * (x * (x * x)))
end function
public static double code(double x, double eps) {
return (eps * 5.0) * (x * (x * (x * x)));
}
def code(x, eps): return (eps * 5.0) * (x * (x * (x * x)))
function code(x, eps) return Float64(Float64(eps * 5.0) * Float64(x * Float64(x * Float64(x * x)))) end
function tmp = code(x, eps) tmp = (eps * 5.0) * (x * (x * (x * x))); end
code[x_, eps_] := N[(N[(eps * 5.0), $MachinePrecision] * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)
\end{array}
Initial program 88.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6483.0
Applied rewrites83.0%
Applied rewrites82.9%
Final simplification82.9%
(FPCore (x eps) :precision binary64 (* eps (* 5.0 (* x (* x (* x x))))))
double code(double x, double eps) {
return eps * (5.0 * (x * (x * (x * x))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (5.0d0 * (x * (x * (x * x))))
end function
public static double code(double x, double eps) {
return eps * (5.0 * (x * (x * (x * x))));
}
def code(x, eps): return eps * (5.0 * (x * (x * (x * x))))
function code(x, eps) return Float64(eps * Float64(5.0 * Float64(x * Float64(x * Float64(x * x))))) end
function tmp = code(x, eps) tmp = eps * (5.0 * (x * (x * (x * x)))); end
code[x_, eps_] := N[(eps * N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)
\end{array}
Initial program 88.9%
Taylor expanded in x around inf
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
+-commutativeN/A
distribute-lft-inN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6483.0
Applied rewrites83.0%
Applied rewrites82.9%
Applied rewrites82.9%
Final simplification82.9%
(FPCore (x eps) :precision binary64 (* eps (* eps (* eps (* (* x x) 10.0)))))
double code(double x, double eps) {
return eps * (eps * (eps * ((x * x) * 10.0)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (eps * (eps * ((x * x) * 10.0d0)))
end function
public static double code(double x, double eps) {
return eps * (eps * (eps * ((x * x) * 10.0)));
}
def code(x, eps): return eps * (eps * (eps * ((x * x) * 10.0)))
function code(x, eps) return Float64(eps * Float64(eps * Float64(eps * Float64(Float64(x * x) * 10.0)))) end
function tmp = code(x, eps) tmp = eps * (eps * (eps * ((x * x) * 10.0))); end
code[x_, eps_] := N[(eps * N[(eps * N[(eps * N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right)
\end{array}
Initial program 88.9%
Taylor expanded in eps around 0
Applied rewrites83.4%
Taylor expanded in x around 0
Applied rewrites71.9%
Taylor expanded in eps around 0
Applied rewrites71.9%
(FPCore (x eps) :precision binary64 (* (* 10.0 (* x (* x x))) (* eps eps)))
double code(double x, double eps) {
return (10.0 * (x * (x * x))) * (eps * eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (10.0d0 * (x * (x * x))) * (eps * eps)
end function
public static double code(double x, double eps) {
return (10.0 * (x * (x * x))) * (eps * eps);
}
def code(x, eps): return (10.0 * (x * (x * x))) * (eps * eps)
function code(x, eps) return Float64(Float64(10.0 * Float64(x * Float64(x * x))) * Float64(eps * eps)) end
function tmp = code(x, eps) tmp = (10.0 * (x * (x * x))) * (eps * eps); end
code[x_, eps_] := N[(N[(10.0 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(10 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)
\end{array}
Initial program 88.9%
Taylor expanded in x around -inf
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
associate-+r+N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
distribute-rgt1-inN/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f64N/A
Applied rewrites83.2%
Taylor expanded in x around 0
Applied rewrites71.8%
Final simplification71.8%
herbie shell --seed 2024237
(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)))