
(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 13 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 -3.2e-43)
(* (pow x 4.0) (- (* eps 5.0) (/ (* (* eps eps) -10.0) x)))
(if (<= x 1.22e-52)
(fma 5.0 (* x (pow eps 4.0)) (pow eps 5.0))
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/
(fma (* eps eps) -10.0 (/ (* (* eps (* eps eps)) (- 10.0)) x))
(- x)))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else if (x <= 1.22e-52) {
tmp = fma(5.0, (x * pow(eps, 4.0)), pow(eps, 5.0));
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, (((eps * (eps * eps)) * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64((x ^ 4.0) * Float64(Float64(eps * 5.0) - Float64(Float64(Float64(eps * eps) * -10.0) / x))); elseif (x <= 1.22e-52) tmp = fma(5.0, Float64(x * (eps ^ 4.0)), (eps ^ 5.0)); else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(Float64(eps * Float64(eps * eps)) * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], 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], If[LessEqual[x, 1.22e-52], N[(5.0 * N[(x * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5 - \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot -10}{x}\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(5, x \cdot {\varepsilon}^{4}, {\varepsilon}^{5}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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 rewrites100.0%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* (pow x 4.0) (- (* eps 5.0) (/ (* (* eps eps) -10.0) x)))
(if (<= x 1.22e-52)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/
(fma (* eps eps) -10.0 (/ (* (* eps (* eps eps)) (- 10.0)) x))
(- x)))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = pow(x, 4.0) * ((eps * 5.0) - (((eps * eps) * -10.0) / x));
} else if (x <= 1.22e-52) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, (((eps * (eps * eps)) * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64((x ^ 4.0) * Float64(Float64(eps * 5.0) - Float64(Float64(Float64(eps * eps) * -10.0) / x))); elseif (x <= 1.22e-52) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(Float64(eps * Float64(eps * eps)) * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], 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], If[LessEqual[x, 1.22e-52], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5 - \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot -10}{x}\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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 rewrites100.0%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
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-/.f6499.7
Applied rewrites99.7%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (pow x 4.0)))
(if (<= x 1.22e-52)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/
(fma (* eps eps) -10.0 (/ (* (* eps (* eps eps)) (- 10.0)) x))
(- x)))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * pow(x, 4.0));
} else if (x <= 1.22e-52) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, (((eps * (eps * eps)) * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); elseif (x <= 1.22e-52) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(Float64(eps * Float64(eps * eps)) * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e-52], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
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-/.f6499.7
Applied rewrites99.7%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.8%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (pow x 4.0)))
(if (<= x 1.22e-52)
(pow eps 5.0)
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/
(fma (* eps eps) -10.0 (/ (* (* eps (* eps eps)) (- 10.0)) x))
(- x)))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * pow(x, 4.0));
} else if (x <= 1.22e-52) {
tmp = pow(eps, 5.0);
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, (((eps * (eps * eps)) * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * (x ^ 4.0))); elseif (x <= 1.22e-52) tmp = eps ^ 5.0; else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(Float64(eps * Float64(eps * eps)) * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e-52], N[Power[eps, 5.0], $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
Taylor expanded in x around 0
lower-pow.f6499.7
Applied rewrites99.7%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.22e-52)
(pow eps 5.0)
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/
(fma (* eps eps) -10.0 (/ (* (* eps (* eps eps)) (- 10.0)) x))
(- x)))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.22e-52) {
tmp = pow(eps, 5.0);
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, (((eps * (eps * eps)) * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.22e-52) tmp = eps ^ 5.0; else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(Float64(eps * Float64(eps * eps)) * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e-52], N[Power[eps, 5.0], $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;{\varepsilon}^{5}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
Taylor expanded in x around 0
lower-pow.f6499.7
Applied rewrites99.7%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* eps eps))))
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.22e-52)
(* (fma x 5.0 eps) (* eps t_0))
(*
(* x (* x (* x x)))
(fma
eps
5.0
(/ (fma (* eps eps) -10.0 (/ (* t_0 (- 10.0)) x)) (- x))))))))
double code(double x, double eps) {
double t_0 = eps * (eps * eps);
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.22e-52) {
tmp = fma(x, 5.0, eps) * (eps * t_0);
} else {
tmp = (x * (x * (x * x))) * fma(eps, 5.0, (fma((eps * eps), -10.0, ((t_0 * -10.0) / x)) / -x));
}
return tmp;
}
function code(x, eps) t_0 = Float64(eps * Float64(eps * eps)) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.22e-52) tmp = Float64(fma(x, 5.0, eps) * Float64(eps * t_0)); else tmp = Float64(Float64(x * Float64(x * Float64(x * x))) * fma(eps, 5.0, Float64(fma(Float64(eps * eps), -10.0, Float64(Float64(t_0 * Float64(-10.0)) / x)) / Float64(-x)))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e-52], N[(N[(x * 5.0 + eps), $MachinePrecision] * N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(eps * 5.0 + N[(N[(N[(eps * eps), $MachinePrecision] * -10.0 + N[(N[(t$95$0 * (-10.0)), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] / (-x)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \left(\varepsilon \cdot t\_0\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 5, \frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -10, \frac{t\_0 \cdot \left(-10\right)}{x}\right)}{-x}\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Applied rewrites99.5%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in x around -inf
Applied rewrites99.9%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* x x) 10.0)))
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.22e-52)
(* (fma x 5.0 eps) (* eps (* eps (* eps eps))))
(*
eps
(fma eps (fma x t_0 (* eps t_0)) (* 5.0 (* x (* x (* x x))))))))))
double code(double x, double eps) {
double t_0 = (x * x) * 10.0;
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.22e-52) {
tmp = fma(x, 5.0, eps) * (eps * (eps * (eps * eps)));
} else {
tmp = eps * fma(eps, fma(x, t_0, (eps * t_0)), (5.0 * (x * (x * (x * x)))));
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(x * x) * 10.0) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.22e-52) tmp = Float64(fma(x, 5.0, eps) * Float64(eps * Float64(eps * Float64(eps * eps)))); else tmp = Float64(eps * fma(eps, fma(x, t_0, Float64(eps * t_0)), Float64(5.0 * Float64(x * Float64(x * Float64(x * x)))))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]}, If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.22e-52], N[(N[(x * 5.0 + eps), $MachinePrecision] * N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(eps * N[(eps * N[(x * t$95$0 + N[(eps * t$95$0), $MachinePrecision]), $MachinePrecision] + N[(5.0 * N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot x\right) \cdot 10\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.22 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(x, t\_0, \varepsilon \cdot t\_0\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.22e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Applied rewrites99.5%
if 1.22e-52 < x Initial program 48.3%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6447.6
Applied rewrites47.6%
Taylor expanded in eps around 0
Applied rewrites99.7%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.9e-52)
(* (fma x 5.0 eps) (* eps (* eps (* eps eps))))
(* (* x x) (* (* eps 5.0) (* x x))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.9e-52) {
tmp = fma(x, 5.0, eps) * (eps * (eps * (eps * eps)));
} else {
tmp = (x * x) * ((eps * 5.0) * (x * x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.9e-52) tmp = Float64(fma(x, 5.0, eps) * Float64(eps * Float64(eps * Float64(eps * eps)))); else tmp = Float64(Float64(x * x) * Float64(Float64(eps * 5.0) * Float64(x * x))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-52], N[(N[(x * 5.0 + eps), $MachinePrecision] * N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.9000000000000002e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Applied rewrites99.5%
if 1.9000000000000002e-52 < x Initial program 48.3%
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.4
Applied rewrites99.4%
Applied rewrites99.6%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.9e-52)
(* (fma x 5.0 eps) (* (* eps eps) (* eps eps)))
(* (* x x) (* (* eps 5.0) (* x x))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.9e-52) {
tmp = fma(x, 5.0, eps) * ((eps * eps) * (eps * eps));
} else {
tmp = (x * x) * ((eps * 5.0) * (x * x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.9e-52) tmp = Float64(fma(x, 5.0, eps) * Float64(Float64(eps * eps) * Float64(eps * eps))); else tmp = Float64(Float64(x * x) * Float64(Float64(eps * 5.0) * Float64(x * x))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-52], N[(N[(x * 5.0 + eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\mathsf{fma}\left(x, 5, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.9000000000000002e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
if 1.9000000000000002e-52 < x Initial program 48.3%
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.4
Applied rewrites99.4%
Applied rewrites99.6%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.9e-52)
(* (* eps eps) (* (* eps eps) (fma x 5.0 eps)))
(* (* x x) (* (* eps 5.0) (* x x))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.9e-52) {
tmp = (eps * eps) * ((eps * eps) * fma(x, 5.0, eps));
} else {
tmp = (x * x) * ((eps * 5.0) * (x * x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.9e-52) tmp = Float64(Float64(eps * eps) * Float64(Float64(eps * eps) * fma(x, 5.0, eps))); else tmp = Float64(Float64(x * x) * Float64(Float64(eps * 5.0) * Float64(x * x))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-52], N[(N[(eps * eps), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * N[(x * 5.0 + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(x, 5, \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.9000000000000002e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
if 1.9000000000000002e-52 < x Initial program 48.3%
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.4
Applied rewrites99.4%
Applied rewrites99.6%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= x -3.2e-43)
(* eps (* 5.0 (* (* x x) (* x x))))
(if (<= x 1.9e-52)
(* (* eps eps) (* eps (* eps eps)))
(* (* x x) (* (* eps 5.0) (* x x))))))
double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.9e-52) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = (x * x) * ((eps * 5.0) * (x * x));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-3.2d-43)) then
tmp = eps * (5.0d0 * ((x * x) * (x * x)))
else if (x <= 1.9d-52) then
tmp = (eps * eps) * (eps * (eps * eps))
else
tmp = (x * x) * ((eps * 5.0d0) * (x * x))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -3.2e-43) {
tmp = eps * (5.0 * ((x * x) * (x * x)));
} else if (x <= 1.9e-52) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = (x * x) * ((eps * 5.0) * (x * x));
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -3.2e-43: tmp = eps * (5.0 * ((x * x) * (x * x))) elif x <= 1.9e-52: tmp = (eps * eps) * (eps * (eps * eps)) else: tmp = (x * x) * ((eps * 5.0) * (x * x)) return tmp
function code(x, eps) tmp = 0.0 if (x <= -3.2e-43) tmp = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))); elseif (x <= 1.9e-52) tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(eps * eps))); else tmp = Float64(Float64(x * x) * Float64(Float64(eps * 5.0) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -3.2e-43) tmp = eps * (5.0 * ((x * x) * (x * x))); elseif (x <= 1.9e-52) tmp = (eps * eps) * (eps * (eps * eps)); else tmp = (x * x) * ((eps * 5.0) * (x * x)); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -3.2e-43], N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.9e-52], N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot x\right)\right)\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43Initial program 47.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.f6499.8
Applied rewrites99.8%
Applied rewrites99.7%
if -3.19999999999999985e-43 < x < 1.9000000000000002e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Taylor expanded in x around 0
Applied rewrites99.5%
if 1.9000000000000002e-52 < x Initial program 48.3%
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.4
Applied rewrites99.4%
Applied rewrites99.6%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* eps (* 5.0 (* (* x x) (* x x))))))
(if (<= x -3.2e-43)
t_0
(if (<= x 1.9e-52) (* (* eps eps) (* eps (* eps eps))) t_0))))
double code(double x, double eps) {
double t_0 = eps * (5.0 * ((x * x) * (x * x)));
double tmp;
if (x <= -3.2e-43) {
tmp = t_0;
} else if (x <= 1.9e-52) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = eps * (5.0d0 * ((x * x) * (x * x)))
if (x <= (-3.2d-43)) then
tmp = t_0
else if (x <= 1.9d-52) then
tmp = (eps * eps) * (eps * (eps * eps))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = eps * (5.0 * ((x * x) * (x * x)));
double tmp;
if (x <= -3.2e-43) {
tmp = t_0;
} else if (x <= 1.9e-52) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = eps * (5.0 * ((x * x) * (x * x))) tmp = 0 if x <= -3.2e-43: tmp = t_0 elif x <= 1.9e-52: tmp = (eps * eps) * (eps * (eps * eps)) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(eps * Float64(5.0 * Float64(Float64(x * x) * Float64(x * x)))) tmp = 0.0 if (x <= -3.2e-43) tmp = t_0; elseif (x <= 1.9e-52) tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(eps * eps))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = eps * (5.0 * ((x * x) * (x * x))); tmp = 0.0; if (x <= -3.2e-43) tmp = t_0; elseif (x <= 1.9e-52) tmp = (eps * eps) * (eps * (eps * eps)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(eps * N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.2e-43], t$95$0, If[LessEqual[x, 1.9e-52], N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \varepsilon \cdot \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right)\\
\mathbf{if}\;x \leq -3.2 \cdot 10^{-43}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.9 \cdot 10^{-52}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -3.19999999999999985e-43 or 1.9000000000000002e-52 < x Initial program 48.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.f6499.5
Applied rewrites99.5%
Applied rewrites99.6%
if -3.19999999999999985e-43 < x < 1.9000000000000002e-52Initial program 99.7%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6499.7
Applied rewrites99.7%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.5%
Taylor expanded in x around 0
Applied rewrites99.5%
Final simplification99.5%
(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(Float64(eps * eps) * Float64(eps * Float64(eps * eps))) end
function tmp = code(x, eps) tmp = (eps * eps) * (eps * (eps * eps)); end
code[x_, eps_] := N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)
\end{array}
Initial program 93.1%
Taylor expanded in x around 0
*-commutativeN/A
distribute-lft1-inN/A
metadata-evalN/A
associate-*l*N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-pow.f64N/A
lower-pow.f6493.0
Applied rewrites93.0%
Taylor expanded in x around 0
+-commutativeN/A
metadata-evalN/A
pow-plusN/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
lower-*.f64N/A
lower-pow.f64N/A
+-commutativeN/A
lower-fma.f6492.9
Applied rewrites92.9%
Applied rewrites92.8%
Taylor expanded in x around 0
Applied rewrites92.8%
Final simplification92.8%
herbie shell --seed 2024221
(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)))