
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
return pow((x + eps), 5.0) - pow(x, 5.0);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps): return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps) return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) end
function tmp = code(x, eps) tmp = ((x + eps) ^ 5.0) - (x ^ 5.0); end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
(if (<= t_0 -1e-273)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(if (<= t_0 0.0)
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0))))
t_0))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -1e-273) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else if (t_0 <= 0.0) {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -1e-273) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); elseif (t_0 <= 0.0) tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-273], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-273}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1e-273Initial 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
Applied rewrites100.0%
if -1e-273 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.6%
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.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 92.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (+ x eps) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (* x (* x x))))
(if (<= t_1 -1e-273)
(* (pow eps 5.0) (fma 5.0 (/ x eps) 1.0))
(if (<= t_1 0.0)
(* t_2 (fma (* x eps) 5.0 (* eps (* eps 10.0))))
(- t_0 (* (* x x) t_2))))))
double code(double x, double eps) {
double t_0 = pow((x + eps), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double t_2 = x * (x * x);
double tmp;
if (t_1 <= -1e-273) {
tmp = pow(eps, 5.0) * fma(5.0, (x / eps), 1.0);
} else if (t_1 <= 0.0) {
tmp = t_2 * fma((x * eps), 5.0, (eps * (eps * 10.0)));
} else {
tmp = t_0 - ((x * x) * t_2);
}
return tmp;
}
function code(x, eps) t_0 = Float64(x + eps) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(x * Float64(x * x)) tmp = 0.0 if (t_1 <= -1e-273) tmp = Float64((eps ^ 5.0) * fma(5.0, Float64(x / eps), 1.0)); elseif (t_1 <= 0.0) tmp = Float64(t_2 * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); else tmp = Float64(t_0 - Float64(Float64(x * x) * t_2)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-273], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(t$95$2 * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[(x * x), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := x \cdot \left(x \cdot x\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-273}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 - \left(x \cdot x\right) \cdot t\_2\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1e-273Initial 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
Applied rewrites100.0%
if -1e-273 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 86.6%
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.9%
Taylor expanded in x around 0
Applied rewrites99.9%
Applied rewrites99.9%
if 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 92.6%
lift-pow.f64N/A
metadata-evalN/A
pow-prod-upN/A
pow2N/A
lower-*.f64N/A
cube-multN/A
lower-*.f64N/A
lower-*.f64N/A
lower-*.f6492.5
Applied rewrites92.5%
Final simplification99.0%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* (* x x) (* x x)) (- (* eps 5.0) (/ (* -10.0 (* eps eps)) x)))
(if (<= x 3.5e-43)
(fma
x
(* (* eps eps) (fma x (* (+ x eps) 10.0) (* eps (* eps 5.0))))
(* (* eps eps) (* eps (* eps eps))))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = ((x * x) * (x * x)) * ((eps * 5.0) - ((-10.0 * (eps * eps)) / x));
} else if (x <= 3.5e-43) {
tmp = fma(x, ((eps * eps) * fma(x, ((x + eps) * 10.0), (eps * (eps * 5.0)))), ((eps * eps) * (eps * (eps * eps))));
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(Float64(eps * 5.0) - Float64(Float64(-10.0 * Float64(eps * eps)) / x))); elseif (x <= 3.5e-43) tmp = fma(x, Float64(Float64(eps * eps) * fma(x, Float64(Float64(x + eps) * 10.0), Float64(eps * Float64(eps * 5.0)))), Float64(Float64(eps * eps) * Float64(eps * Float64(eps * eps)))); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] - N[(N[(-10.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(x * N[(N[(x + eps), $MachinePrecision] * 10.0), $MachinePrecision] + N[(eps * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot 5 - \frac{-10 \cdot \left(\varepsilon \cdot \varepsilon\right)}{x}\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(x, \left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(x, \left(x + \varepsilon\right) \cdot 10, \varepsilon \cdot \left(\varepsilon \cdot 5\right)\right), \left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Applied rewrites91.3%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.9%
Applied rewrites98.9%
Applied rewrites98.9%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* (* x x) (* x x)) (- (* eps 5.0) (/ (* -10.0 (* eps eps)) x)))
(if (<= x 3.5e-43)
(fma
x
(* (* eps eps) (fma eps (* eps 5.0) (* x (* (+ x eps) 10.0))))
(* eps (* eps (* eps (* eps eps)))))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = ((x * x) * (x * x)) * ((eps * 5.0) - ((-10.0 * (eps * eps)) / x));
} else if (x <= 3.5e-43) {
tmp = fma(x, ((eps * eps) * fma(eps, (eps * 5.0), (x * ((x + eps) * 10.0)))), (eps * (eps * (eps * (eps * eps)))));
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(Float64(eps * 5.0) - Float64(Float64(-10.0 * Float64(eps * eps)) / x))); elseif (x <= 3.5e-43) tmp = fma(x, Float64(Float64(eps * eps) * fma(eps, Float64(eps * 5.0), Float64(x * Float64(Float64(x + eps) * 10.0)))), Float64(eps * Float64(eps * Float64(eps * Float64(eps * eps))))); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] - N[(N[(-10.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(x * N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * 5.0), $MachinePrecision] + N[(x * N[(N[(x + eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot 5 - \frac{-10 \cdot \left(\varepsilon \cdot \varepsilon\right)}{x}\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(x, \left(\varepsilon \cdot \varepsilon\right) \cdot \mathsf{fma}\left(\varepsilon, \varepsilon \cdot 5, x \cdot \left(\left(x + \varepsilon\right) \cdot 10\right)\right), \varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Applied rewrites91.3%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.9%
Taylor expanded in eps around 0
Applied rewrites98.9%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* (* x x) (* x x)) (- (* eps 5.0) (/ (* -10.0 (* eps eps)) x)))
(if (<= x 3.5e-43)
(*
eps
(* eps (fma x (* x (* (+ x eps) 10.0)) (* eps (* eps (fma 5.0 x eps))))))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = ((x * x) * (x * x)) * ((eps * 5.0) - ((-10.0 * (eps * eps)) / x));
} else if (x <= 3.5e-43) {
tmp = eps * (eps * fma(x, (x * ((x + eps) * 10.0)), (eps * (eps * fma(5.0, x, eps)))));
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(Float64(x * x) * Float64(x * x)) * Float64(Float64(eps * 5.0) - Float64(Float64(-10.0 * Float64(eps * eps)) / x))); elseif (x <= 3.5e-43) tmp = Float64(eps * Float64(eps * fma(x, Float64(x * Float64(Float64(x + eps) * 10.0)), Float64(eps * Float64(eps * fma(5.0, x, eps)))))); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * 5.0), $MachinePrecision] - N[(N[(-10.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(eps * N[(eps * N[(x * N[(x * N[(N[(x + eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(eps * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot 5 - \frac{-10 \cdot \left(\varepsilon \cdot \varepsilon\right)}{x}\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, x \cdot \left(\left(x + \varepsilon\right) \cdot 10\right), \varepsilon \cdot \left(\varepsilon \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Applied rewrites91.3%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.9%
Taylor expanded in eps around 0
Applied rewrites98.9%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* eps (fma x 5.0 (* eps 10.0)))))
(if (<= x 3.5e-43)
(*
eps
(* eps (fma x (* x (* (+ x eps) 10.0)) (* eps (* eps (fma 5.0 x eps))))))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (eps * fma(x, 5.0, (eps * 10.0))));
} else if (x <= 3.5e-43) {
tmp = eps * (eps * fma(x, (x * ((x + eps) * 10.0)), (eps * (eps * fma(5.0, x, eps)))));
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(eps * fma(x, 5.0, Float64(eps * 10.0))))); elseif (x <= 3.5e-43) tmp = Float64(eps * Float64(eps * fma(x, Float64(x * Float64(Float64(x + eps) * 10.0)), Float64(eps * Float64(eps * fma(5.0, x, eps)))))); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(eps * N[(x * 5.0 + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(eps * N[(eps * N[(x * N[(x * N[(N[(x + eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(eps * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, 5, \varepsilon \cdot 10\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\varepsilon \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, x \cdot \left(\left(x + \varepsilon\right) \cdot 10\right), \varepsilon \cdot \left(\varepsilon \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Taylor expanded in x around 0
Applied rewrites91.1%
Applied rewrites91.2%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.9%
Taylor expanded in eps around 0
Applied rewrites98.9%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* eps (fma x 5.0 (* eps 10.0)))))
(if (<= x 3.5e-43)
(* (* eps (* eps eps)) (fma eps (fma 5.0 x eps) (* x (* x 10.0))))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (eps * fma(x, 5.0, (eps * 10.0))));
} else if (x <= 3.5e-43) {
tmp = (eps * (eps * eps)) * fma(eps, fma(5.0, x, eps), (x * (x * 10.0)));
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(eps * fma(x, 5.0, Float64(eps * 10.0))))); elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * Float64(eps * eps)) * fma(eps, fma(5.0, x, eps), Float64(x * Float64(x * 10.0)))); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(eps * N[(x * 5.0 + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(5.0 * x + eps), $MachinePrecision] + N[(x * N[(x * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, 5, \varepsilon \cdot 10\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \mathsf{fma}\left(\varepsilon, \mathsf{fma}\left(5, x, \varepsilon\right), x \cdot \left(x \cdot 10\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Taylor expanded in x around 0
Applied rewrites91.1%
Applied rewrites91.2%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.8%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.3%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* eps (fma x 5.0 (* eps 10.0)))))
(if (<= x 3.5e-43)
(* (* eps (* eps (* eps eps))) (fma 5.0 x eps))
(* (* x (* x x)) (fma (* x eps) 5.0 (* eps (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (eps * fma(x, 5.0, (eps * 10.0))));
} else if (x <= 3.5e-43) {
tmp = (eps * (eps * (eps * eps))) * fma(5.0, x, eps);
} else {
tmp = (x * (x * x)) * fma((x * eps), 5.0, (eps * (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(eps * fma(x, 5.0, Float64(eps * 10.0))))); elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(5.0, x, eps)); else tmp = Float64(Float64(x * Float64(x * x)) * fma(Float64(x * eps), 5.0, Float64(eps * Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(eps * N[(x * 5.0 + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(N[(x * eps), $MachinePrecision] * 5.0 + N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, 5, \varepsilon \cdot 10\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(x \cdot \varepsilon, 5, \varepsilon \cdot \left(\varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Taylor expanded in x around 0
Applied rewrites91.1%
Applied rewrites91.2%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
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
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.7
Applied rewrites98.7%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Applied rewrites98.8%
Final simplification98.2%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* eps (fma x 5.0 (* eps 10.0)))))
(if (<= x 3.5e-43)
(* (* eps (* eps (* eps eps))) (fma 5.0 x eps))
(* (* x (* x x)) (* eps (fma 5.0 x (* eps 10.0)))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (eps * fma(x, 5.0, (eps * 10.0))));
} else if (x <= 3.5e-43) {
tmp = (eps * (eps * (eps * eps))) * fma(5.0, x, eps);
} else {
tmp = (x * (x * x)) * (eps * fma(5.0, x, (eps * 10.0)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(eps * fma(x, 5.0, Float64(eps * 10.0))))); elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(5.0, x, eps)); else tmp = Float64(Float64(x * Float64(x * x)) * Float64(eps * fma(5.0, x, Float64(eps * 10.0)))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(eps * N[(x * 5.0 + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(5.0 * x + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(\varepsilon \cdot \mathsf{fma}\left(x, 5, \varepsilon \cdot 10\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot \mathsf{fma}\left(5, x, \varepsilon \cdot 10\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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 rewrites91.1%
Taylor expanded in x around 0
Applied rewrites91.1%
Applied rewrites91.2%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
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
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.7
Applied rewrites98.7%
if 3.49999999999999997e-43 < x Initial program 29.3%
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 rewrites98.9%
Taylor expanded in x around 0
Applied rewrites98.7%
Final simplification98.2%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* x (* x x)) (* eps (fma 5.0 x (* eps 10.0))))))
(if (<= x -7.1e-40)
t_0
(if (<= x 3.5e-43) (* (* eps (* eps (* eps eps))) (fma 5.0 x eps)) t_0))))
double code(double x, double eps) {
double t_0 = (x * (x * x)) * (eps * fma(5.0, x, (eps * 10.0)));
double tmp;
if (x <= -7.1e-40) {
tmp = t_0;
} else if (x <= 3.5e-43) {
tmp = (eps * (eps * (eps * eps))) * fma(5.0, x, eps);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(x * Float64(x * x)) * Float64(eps * fma(5.0, x, Float64(eps * 10.0)))) tmp = 0.0 if (x <= -7.1e-40) tmp = t_0; elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(5.0, x, eps)); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(eps * N[(5.0 * x + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.1e-40], t$95$0, If[LessEqual[x, 3.5e-43], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(x \cdot \left(x \cdot x\right)\right) \cdot \left(\varepsilon \cdot \mathsf{fma}\left(5, x, \varepsilon \cdot 10\right)\right)\\
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40 or 3.49999999999999997e-43 < x Initial program 29.1%
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 rewrites95.4%
Taylor expanded in x around 0
Applied rewrites95.3%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
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
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.7
Applied rewrites98.7%
Final simplification98.2%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* 5.0 (* x eps))))
(if (<= x 3.5e-43)
(* (* eps (* eps (* eps eps))) (fma 5.0 x eps))
(* 5.0 (* (* x (* x x)) (* x eps))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (5.0 * (x * eps)));
} else if (x <= 3.5e-43) {
tmp = (eps * (eps * (eps * eps))) * fma(5.0, x, eps);
} else {
tmp = 5.0 * ((x * (x * x)) * (x * eps));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(5.0 * Float64(x * eps)))); elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * Float64(eps * Float64(eps * eps))) * fma(5.0, x, eps)); else tmp = Float64(5.0 * Float64(Float64(x * Float64(x * x)) * Float64(x * eps))); end return tmp end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(5.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(N[(eps * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(5.0 * x + eps), $MachinePrecision]), $MachinePrecision], N[(5.0 * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(5 \cdot \left(x \cdot \varepsilon\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\right) \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \varepsilon\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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.f6490.7
Applied rewrites90.7%
Applied rewrites90.6%
Applied rewrites90.7%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
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
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
+-commutativeN/A
lower-fma.f6498.7
Applied rewrites98.7%
if 3.49999999999999997e-43 < x Initial program 29.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.f6495.2
Applied rewrites95.2%
Applied rewrites95.2%
Applied rewrites95.3%
Final simplification97.9%
(FPCore (x eps)
:precision binary64
(if (<= x -7.1e-40)
(* (* x x) (* x (* 5.0 (* x eps))))
(if (<= x 3.5e-43)
(* (* eps eps) (* eps (* eps eps)))
(* 5.0 (* (* x (* x x)) (* x eps))))))
double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (5.0 * (x * eps)));
} else if (x <= 3.5e-43) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = 5.0 * ((x * (x * x)) * (x * eps));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (x <= (-7.1d-40)) then
tmp = (x * x) * (x * (5.0d0 * (x * eps)))
else if (x <= 3.5d-43) then
tmp = (eps * eps) * (eps * (eps * eps))
else
tmp = 5.0d0 * ((x * (x * x)) * (x * eps))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (x <= -7.1e-40) {
tmp = (x * x) * (x * (5.0 * (x * eps)));
} else if (x <= 3.5e-43) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = 5.0 * ((x * (x * x)) * (x * eps));
}
return tmp;
}
def code(x, eps): tmp = 0 if x <= -7.1e-40: tmp = (x * x) * (x * (5.0 * (x * eps))) elif x <= 3.5e-43: tmp = (eps * eps) * (eps * (eps * eps)) else: tmp = 5.0 * ((x * (x * x)) * (x * eps)) return tmp
function code(x, eps) tmp = 0.0 if (x <= -7.1e-40) tmp = Float64(Float64(x * x) * Float64(x * Float64(5.0 * Float64(x * eps)))); elseif (x <= 3.5e-43) tmp = Float64(Float64(eps * eps) * Float64(eps * Float64(eps * eps))); else tmp = Float64(5.0 * Float64(Float64(x * Float64(x * x)) * Float64(x * eps))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (x <= -7.1e-40) tmp = (x * x) * (x * (5.0 * (x * eps))); elseif (x <= 3.5e-43) tmp = (eps * eps) * (eps * (eps * eps)); else tmp = 5.0 * ((x * (x * x)) * (x * eps)); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[x, -7.1e-40], N[(N[(x * x), $MachinePrecision] * N[(x * N[(5.0 * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 3.5e-43], N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(5.0 * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot \left(5 \cdot \left(x \cdot \varepsilon\right)\right)\right)\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \varepsilon\right)\right)\\
\mathbf{else}:\\
\;\;\;\;5 \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \varepsilon\right)\right)\\
\end{array}
\end{array}
if x < -7.10000000000000023e-40Initial program 28.8%
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.f6490.7
Applied rewrites90.7%
Applied rewrites90.6%
Applied rewrites90.7%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.5
Applied rewrites98.5%
Applied rewrites98.5%
if 3.49999999999999997e-43 < x Initial program 29.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.f6495.2
Applied rewrites95.2%
Applied rewrites95.2%
Applied rewrites95.3%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* 5.0 (* (* x (* x x)) (* x eps)))))
(if (<= x -7.1e-40)
t_0
(if (<= x 3.5e-43) (* (* eps eps) (* eps (* eps eps))) t_0))))
double code(double x, double eps) {
double t_0 = 5.0 * ((x * (x * x)) * (x * eps));
double tmp;
if (x <= -7.1e-40) {
tmp = t_0;
} else if (x <= 3.5e-43) {
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 = 5.0d0 * ((x * (x * x)) * (x * eps))
if (x <= (-7.1d-40)) then
tmp = t_0
else if (x <= 3.5d-43) 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 = 5.0 * ((x * (x * x)) * (x * eps));
double tmp;
if (x <= -7.1e-40) {
tmp = t_0;
} else if (x <= 3.5e-43) {
tmp = (eps * eps) * (eps * (eps * eps));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = 5.0 * ((x * (x * x)) * (x * eps)) tmp = 0 if x <= -7.1e-40: tmp = t_0 elif x <= 3.5e-43: tmp = (eps * eps) * (eps * (eps * eps)) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(5.0 * Float64(Float64(x * Float64(x * x)) * Float64(x * eps))) tmp = 0.0 if (x <= -7.1e-40) tmp = t_0; elseif (x <= 3.5e-43) 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 = 5.0 * ((x * (x * x)) * (x * eps)); tmp = 0.0; if (x <= -7.1e-40) tmp = t_0; elseif (x <= 3.5e-43) tmp = (eps * eps) * (eps * (eps * eps)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(5.0 * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.1e-40], t$95$0, If[LessEqual[x, 3.5e-43], N[(N[(eps * eps), $MachinePrecision] * N[(eps * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 5 \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \varepsilon\right)\right)\\
\mathbf{if}\;x \leq -7.1 \cdot 10^{-40}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-43}:\\
\;\;\;\;\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 < -7.10000000000000023e-40 or 3.49999999999999997e-43 < x Initial program 29.1%
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.f6493.2
Applied rewrites93.2%
Applied rewrites93.1%
Applied rewrites93.2%
if -7.10000000000000023e-40 < x < 3.49999999999999997e-43Initial program 99.2%
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-/.f6498.9
Applied rewrites98.9%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6498.5
Applied rewrites98.5%
Applied rewrites98.5%
Final simplification97.7%
(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 88.3%
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-/.f6487.1
Applied rewrites87.1%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Applied rewrites86.7%
Final simplification86.7%
(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 88.3%
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-/.f6487.1
Applied rewrites87.1%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Final simplification86.7%
(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 88.3%
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-/.f6487.1
Applied rewrites87.1%
Taylor expanded in x around 0
metadata-evalN/A
pow-plusN/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
pow-plusN/A
lower-*.f64N/A
cube-multN/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6486.7
Applied rewrites86.7%
Applied rewrites86.7%
herbie shell --seed 2024233
(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)))