
(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 15 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 (+ eps x) 5.0))
(t_1 (- t_0 (pow x 5.0)))
(t_2 (+ t_0 (pow x 5.0)))
(t_3 (* (/ t_1 t_2) t_2)))
(if (<= t_1 -2e-301)
t_3
(if (<= t_1 0.0) (* (* (pow x 4.0) 5.0) eps) t_3))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0);
double t_1 = t_0 - pow(x, 5.0);
double t_2 = t_0 + pow(x, 5.0);
double t_3 = (t_1 / t_2) * t_2;
double tmp;
if (t_1 <= -2e-301) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = (pow(x, 4.0) * 5.0) * eps;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = (eps + x) ** 5.0d0
t_1 = t_0 - (x ** 5.0d0)
t_2 = t_0 + (x ** 5.0d0)
t_3 = (t_1 / t_2) * t_2
if (t_1 <= (-2d-301)) then
tmp = t_3
else if (t_1 <= 0.0d0) then
tmp = ((x ** 4.0d0) * 5.0d0) * eps
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((eps + x), 5.0);
double t_1 = t_0 - Math.pow(x, 5.0);
double t_2 = t_0 + Math.pow(x, 5.0);
double t_3 = (t_1 / t_2) * t_2;
double tmp;
if (t_1 <= -2e-301) {
tmp = t_3;
} else if (t_1 <= 0.0) {
tmp = (Math.pow(x, 4.0) * 5.0) * eps;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((eps + x), 5.0) t_1 = t_0 - math.pow(x, 5.0) t_2 = t_0 + math.pow(x, 5.0) t_3 = (t_1 / t_2) * t_2 tmp = 0 if t_1 <= -2e-301: tmp = t_3 elif t_1 <= 0.0: tmp = (math.pow(x, 4.0) * 5.0) * eps else: tmp = t_3 return tmp
function code(x, eps) t_0 = Float64(eps + x) ^ 5.0 t_1 = Float64(t_0 - (x ^ 5.0)) t_2 = Float64(t_0 + (x ^ 5.0)) t_3 = Float64(Float64(t_1 / t_2) * t_2) tmp = 0.0 if (t_1 <= -2e-301) tmp = t_3; elseif (t_1 <= 0.0) tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps); else tmp = t_3; end return tmp end
function tmp_2 = code(x, eps) t_0 = (eps + x) ^ 5.0; t_1 = t_0 - (x ^ 5.0); t_2 = t_0 + (x ^ 5.0); t_3 = (t_1 / t_2) * t_2; tmp = 0.0; if (t_1 <= -2e-301) tmp = t_3; elseif (t_1 <= 0.0) tmp = ((x ^ 4.0) * 5.0) * eps; else tmp = t_3; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 + N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(t$95$1 / t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$1, -2e-301], t$95$3, If[LessEqual[t$95$1, 0.0], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5}\\
t_1 := t\_0 - {x}^{5}\\
t_2 := t\_0 + {x}^{5}\\
t_3 := \frac{t\_1}{t\_2} \cdot t\_2\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.00000000000000013e-301 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
lift--.f64N/A
flip--N/A
difference-of-squaresN/A
lift--.f64N/A
associate-/l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
Applied rewrites98.0%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-301)
t_0
(if (<= t_0 0.0) (* (* (pow x 4.0) 5.0) eps) t_0))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-301) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (pow(x, 4.0) * 5.0) * 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 + x) ** 5.0d0) - (x ** 5.0d0)
if (t_0 <= (-2d-301)) then
tmp = t_0
else if (t_0 <= 0.0d0) then
tmp = ((x ** 4.0d0) * 5.0d0) * eps
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow((eps + x), 5.0) - Math.pow(x, 5.0);
double tmp;
if (t_0 <= -2e-301) {
tmp = t_0;
} else if (t_0 <= 0.0) {
tmp = (Math.pow(x, 4.0) * 5.0) * eps;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = math.pow((eps + x), 5.0) - math.pow(x, 5.0) tmp = 0 if t_0 <= -2e-301: tmp = t_0 elif t_0 <= 0.0: tmp = (math.pow(x, 4.0) * 5.0) * eps else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-301) tmp = t_0; elseif (t_0 <= 0.0) tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = ((eps + x) ^ 5.0) - (x ^ 5.0); tmp = 0.0; if (t_0 <= -2e-301) tmp = t_0; elseif (t_0 <= 0.0) tmp = ((x ^ 4.0) * 5.0) * eps; else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-301], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
\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))) < -2.00000000000000013e-301 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-301)
(*
(pow eps 5.0)
(+
1.0
(/
(fma 5.0 x (* (* (* (fma (/ x eps) -10.0 -10.0) x) x) (/ -1.0 eps)))
eps)))
(if (<= t_0 0.0)
(* (* (pow x 4.0) 5.0) eps)
(*
(+ (/ (fma 5.0 x (/ (* (* x x) -10.0) (- eps))) eps) 1.0)
(pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-301) {
tmp = pow(eps, 5.0) * (1.0 + (fma(5.0, x, (((fma((x / eps), -10.0, -10.0) * x) * x) * (-1.0 / eps))) / eps));
} else if (t_0 <= 0.0) {
tmp = (pow(x, 4.0) * 5.0) * eps;
} else {
tmp = ((fma(5.0, x, (((x * x) * -10.0) / -eps)) / eps) + 1.0) * pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-301) tmp = Float64((eps ^ 5.0) * Float64(1.0 + Float64(fma(5.0, x, Float64(Float64(Float64(fma(Float64(x / eps), -10.0, -10.0) * x) * x) * Float64(-1.0 / eps))) / eps))); elseif (t_0 <= 0.0) tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps); else tmp = Float64(Float64(Float64(fma(5.0, x, Float64(Float64(Float64(x * x) * -10.0) / Float64(-eps))) / eps) + 1.0) * (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-301], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(1.0 + N[(N[(5.0 * x + N[(N[(N[(N[(N[(x / eps), $MachinePrecision] * -10.0 + -10.0), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * N[(-1.0 / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(5.0 * x + N[(N[(N[(x * x), $MachinePrecision] * -10.0), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + \frac{\mathsf{fma}\left(5, x, \left(\left(\mathsf{fma}\left(\frac{x}{\varepsilon}, -10, -10\right) \cdot x\right) \cdot x\right) \cdot \frac{-1}{\varepsilon}\right)}{\varepsilon}\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(5, x, \frac{\left(x \cdot x\right) \cdot -10}{-\varepsilon}\right)}{\varepsilon} + 1\right) \cdot {\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.00000000000000013e-301Initial program 98.4%
Taylor expanded in eps around -inf
Applied rewrites86.5%
Taylor expanded in x around 0
Applied rewrites86.5%
Applied rewrites86.5%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.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 97.6%
Taylor expanded in eps around -inf
associate-*r*N/A
*-commutativeN/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
distribute-lft1-inN/A
associate-*l*N/A
Applied rewrites92.2%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0))))
(if (<= t_0 -2e-301)
(*
(+
(/ (fma 5.0 x (/ (* (* x x) (fma (/ x eps) -10.0 -10.0)) (- eps))) eps)
1.0)
(pow eps 5.0))
(if (<= t_0 0.0)
(* (* (pow x 4.0) 5.0) eps)
(*
(+ (/ (fma 5.0 x (/ (* (* x x) -10.0) (- eps))) eps) 1.0)
(pow eps 5.0))))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double tmp;
if (t_0 <= -2e-301) {
tmp = ((fma(5.0, x, (((x * x) * fma((x / eps), -10.0, -10.0)) / -eps)) / eps) + 1.0) * pow(eps, 5.0);
} else if (t_0 <= 0.0) {
tmp = (pow(x, 4.0) * 5.0) * eps;
} else {
tmp = ((fma(5.0, x, (((x * x) * -10.0) / -eps)) / eps) + 1.0) * pow(eps, 5.0);
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) tmp = 0.0 if (t_0 <= -2e-301) tmp = Float64(Float64(Float64(fma(5.0, x, Float64(Float64(Float64(x * x) * fma(Float64(x / eps), -10.0, -10.0)) / Float64(-eps))) / eps) + 1.0) * (eps ^ 5.0)); elseif (t_0 <= 0.0) tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps); else tmp = Float64(Float64(Float64(fma(5.0, x, Float64(Float64(Float64(x * x) * -10.0) / Float64(-eps))) / eps) + 1.0) * (eps ^ 5.0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-301], N[(N[(N[(N[(5.0 * x + N[(N[(N[(x * x), $MachinePrecision] * N[(N[(x / eps), $MachinePrecision] * -10.0 + -10.0), $MachinePrecision]), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(5.0 * x + N[(N[(N[(x * x), $MachinePrecision] * -10.0), $MachinePrecision] / (-eps)), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(5, x, \frac{\left(x \cdot x\right) \cdot \mathsf{fma}\left(\frac{x}{\varepsilon}, -10, -10\right)}{-\varepsilon}\right)}{\varepsilon} + 1\right) \cdot {\varepsilon}^{5}\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(5, x, \frac{\left(x \cdot x\right) \cdot -10}{-\varepsilon}\right)}{\varepsilon} + 1\right) \cdot {\varepsilon}^{5}\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.00000000000000013e-301Initial program 98.4%
Taylor expanded in eps around -inf
Applied rewrites86.5%
Taylor expanded in x around 0
Applied rewrites86.5%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.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 97.6%
Taylor expanded in eps around -inf
associate-*r*N/A
*-commutativeN/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
distribute-lft1-inN/A
associate-*l*N/A
Applied rewrites92.2%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1
(* (* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (* eps eps)) eps)))
(if (<= t_0 -2e-301)
t_1
(if (<= t_0 0.0) (* (* (* (* (* x x) x) x) 5.0) eps) t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = (fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * (eps * eps)) * eps;
double tmp;
if (t_0 <= -2e-301) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((((x * x) * x) * x) * 5.0) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * Float64(eps * eps)) * eps) tmp = 0.0 if (t_0 <= -2e-301) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * 5.0) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-301], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot 5\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.00000000000000013e-301 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.8%
Taylor expanded in eps around 0
Applied rewrites88.5%
Applied rewrites88.2%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
lift-+.f64N/A
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower--.f6482.5
Applied rewrites82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification97.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (pow (+ eps x) 5.0) (pow x 5.0)))
(t_1
(* (* (* eps eps) eps) (fma (fma 5.0 x eps) eps (* (* x x) 10.0)))))
(if (<= t_0 -2e-301)
t_1
(if (<= t_0 0.0) (* (* (* (* (* x x) x) x) 5.0) eps) t_1))))
double code(double x, double eps) {
double t_0 = pow((eps + x), 5.0) - pow(x, 5.0);
double t_1 = ((eps * eps) * eps) * fma(fma(5.0, x, eps), eps, ((x * x) * 10.0));
double tmp;
if (t_0 <= -2e-301) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = ((((x * x) * x) * x) * 5.0) * eps;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, eps) t_0 = Float64((Float64(eps + x) ^ 5.0) - (x ^ 5.0)) t_1 = Float64(Float64(Float64(eps * eps) * eps) * fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0))) tmp = 0.0 if (t_0 <= -2e-301) tmp = t_1; elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * 5.0) * eps); else tmp = t_1; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(eps + x), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision] * N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-301], t$95$1, If[LessEqual[t$95$0, 0.0], N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\varepsilon + x\right)}^{5} - {x}^{5}\\
t_1 := \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right)\\
\mathbf{if}\;t\_0 \leq -2 \cdot 10^{-301}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot 5\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -2.00000000000000013e-301 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) Initial program 98.0%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites88.8%
Taylor expanded in eps around 0
Applied rewrites88.5%
Applied rewrites88.2%
if -2.00000000000000013e-301 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0Initial program 82.5%
lift-+.f64N/A
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower--.f6482.5
Applied rewrites82.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6499.9
Applied rewrites99.9%
Applied rewrites99.9%
Applied rewrites99.9%
Final simplification97.5%
(FPCore (x eps)
:precision binary64
(if (<= x -1.45e-58)
(* (+ (fma (/ (* eps eps) x) 10.0 (* 4.0 eps)) eps) (pow x 4.0))
(if (<= x 4.5e-33)
(* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (pow eps 3.0))
(* (* (fma (/ eps x) 10.0 5.0) eps) (pow x 4.0)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.45e-58) {
tmp = (fma(((eps * eps) / x), 10.0, (4.0 * eps)) + eps) * pow(x, 4.0);
} else if (x <= 4.5e-33) {
tmp = fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * pow(eps, 3.0);
} else {
tmp = (fma((eps / x), 10.0, 5.0) * eps) * pow(x, 4.0);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -1.45e-58) tmp = Float64(Float64(fma(Float64(Float64(eps * eps) / x), 10.0, Float64(4.0 * eps)) + eps) * (x ^ 4.0)); elseif (x <= 4.5e-33) tmp = Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * (eps ^ 3.0)); else tmp = Float64(Float64(fma(Float64(eps / x), 10.0, 5.0) * eps) * (x ^ 4.0)); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.45e-58], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] / x), $MachinePrecision] * 10.0 + N[(4.0 * eps), $MachinePrecision]), $MachinePrecision] + eps), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-33], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 5.0), $MachinePrecision] * eps), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\varepsilon \cdot \varepsilon}{x}, 10, 4 \cdot \varepsilon\right) + \varepsilon\right) \cdot {x}^{4}\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot {\varepsilon}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 5\right) \cdot \varepsilon\right) \cdot {x}^{4}\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58Initial program 33.3%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
associate-+r+N/A
distribute-rgt-outN/A
lower-fma.f64N/A
lower-/.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6490.8
Applied rewrites90.8%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
if 4.49999999999999991e-33 < x Initial program 13.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Taylor expanded in eps around 0
Applied rewrites99.3%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* (fma (/ eps x) 10.0 5.0) eps) (pow x 4.0))))
(if (<= x -1.45e-58)
t_0
(if (<= x 4.5e-33)
(* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (pow eps 3.0))
t_0))))
double code(double x, double eps) {
double t_0 = (fma((eps / x), 10.0, 5.0) * eps) * pow(x, 4.0);
double tmp;
if (x <= -1.45e-58) {
tmp = t_0;
} else if (x <= 4.5e-33) {
tmp = fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * pow(eps, 3.0);
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(fma(Float64(eps / x), 10.0, 5.0) * eps) * (x ^ 4.0)) tmp = 0.0 if (x <= -1.45e-58) tmp = t_0; elseif (x <= 4.5e-33) tmp = Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * (eps ^ 3.0)); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(eps / x), $MachinePrecision] * 10.0 + 5.0), $MachinePrecision] * eps), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e-58], t$95$0, If[LessEqual[x, 4.5e-33], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(\frac{\varepsilon}{x}, 10, 5\right) \cdot \varepsilon\right) \cdot {x}^{4}\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot {\varepsilon}^{3}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58 or 4.49999999999999991e-33 < x Initial program 27.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.4%
Taylor expanded in eps around 0
Applied rewrites93.4%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(if (<= x -1.45e-58)
(* (pow x 3.0) (fma (* eps x) 5.0 (* (* eps eps) 10.0)))
(if (<= x 4.5e-33)
(* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (pow eps 3.0))
(* (* (fma (/ 10.0 x) (* eps eps) (* 5.0 eps)) (* x x)) (* x x)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.45e-58) {
tmp = pow(x, 3.0) * fma((eps * x), 5.0, ((eps * eps) * 10.0));
} else if (x <= 4.5e-33) {
tmp = fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * pow(eps, 3.0);
} else {
tmp = (fma((10.0 / x), (eps * eps), (5.0 * eps)) * (x * x)) * (x * x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -1.45e-58) tmp = Float64((x ^ 3.0) * fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0))); elseif (x <= 4.5e-33) tmp = Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * (eps ^ 3.0)); else tmp = Float64(Float64(fma(Float64(10.0 / x), Float64(eps * eps), Float64(5.0 * eps)) * Float64(x * x)) * Float64(x * x)); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.45e-58], N[(N[Power[x, 3.0], $MachinePrecision] * N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-33], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(10.0 / x), $MachinePrecision] * N[(eps * eps), $MachinePrecision] + N[(5.0 * eps), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;{x}^{3} \cdot \mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot {\varepsilon}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{10}{x}, \varepsilon \cdot \varepsilon, 5 \cdot \varepsilon\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58Initial program 33.3%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.8%
Taylor expanded in x around 0
Applied rewrites90.8%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
if 4.49999999999999991e-33 < x Initial program 13.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(if (<= x -1.45e-58)
(* (pow x 3.0) (fma (* eps x) 5.0 (* (* eps eps) 10.0)))
(if (<= x 4.5e-33)
(* (fma (* x x) 10.0 (* (fma 5.0 x eps) eps)) (pow eps 3.0))
(* (* (fma (/ 10.0 x) (* eps eps) (* 5.0 eps)) (* x x)) (* x x)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.45e-58) {
tmp = pow(x, 3.0) * fma((eps * x), 5.0, ((eps * eps) * 10.0));
} else if (x <= 4.5e-33) {
tmp = fma((x * x), 10.0, (fma(5.0, x, eps) * eps)) * pow(eps, 3.0);
} else {
tmp = (fma((10.0 / x), (eps * eps), (5.0 * eps)) * (x * x)) * (x * x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -1.45e-58) tmp = Float64((x ^ 3.0) * fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0))); elseif (x <= 4.5e-33) tmp = Float64(fma(Float64(x * x), 10.0, Float64(fma(5.0, x, eps) * eps)) * (eps ^ 3.0)); else tmp = Float64(Float64(fma(Float64(10.0 / x), Float64(eps * eps), Float64(5.0 * eps)) * Float64(x * x)) * Float64(x * x)); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.45e-58], N[(N[Power[x, 3.0], $MachinePrecision] * N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-33], N[(N[(N[(x * x), $MachinePrecision] * 10.0 + N[(N[(5.0 * x + eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(10.0 / x), $MachinePrecision] * N[(eps * eps), $MachinePrecision] + N[(5.0 * eps), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;{x}^{3} \cdot \mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\mathsf{fma}\left(x \cdot x, 10, \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot {\varepsilon}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{10}{x}, \varepsilon \cdot \varepsilon, 5 \cdot \varepsilon\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58Initial program 33.3%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.8%
Taylor expanded in x around 0
Applied rewrites90.8%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
Applied rewrites98.7%
if 4.49999999999999991e-33 < x Initial program 13.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification97.7%
(FPCore (x eps)
:precision binary64
(if (<= x -1.45e-58)
(* (pow x 3.0) (fma (* eps x) 5.0 (* (* eps eps) 10.0)))
(if (<= x 4.5e-33)
(* (* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (* eps eps)) eps)
(* (* (fma (/ 10.0 x) (* eps eps) (* 5.0 eps)) (* x x)) (* x x)))))
double code(double x, double eps) {
double tmp;
if (x <= -1.45e-58) {
tmp = pow(x, 3.0) * fma((eps * x), 5.0, ((eps * eps) * 10.0));
} else if (x <= 4.5e-33) {
tmp = (fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * (eps * eps)) * eps;
} else {
tmp = (fma((10.0 / x), (eps * eps), (5.0 * eps)) * (x * x)) * (x * x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (x <= -1.45e-58) tmp = Float64((x ^ 3.0) * fma(Float64(eps * x), 5.0, Float64(Float64(eps * eps) * 10.0))); elseif (x <= 4.5e-33) tmp = Float64(Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * Float64(eps * eps)) * eps); else tmp = Float64(Float64(fma(Float64(10.0 / x), Float64(eps * eps), Float64(5.0 * eps)) * Float64(x * x)) * Float64(x * x)); end return tmp end
code[x_, eps_] := If[LessEqual[x, -1.45e-58], N[(N[Power[x, 3.0], $MachinePrecision] * N[(N[(eps * x), $MachinePrecision] * 5.0 + N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.5e-33], N[(N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(10.0 / x), $MachinePrecision] * N[(eps * eps), $MachinePrecision] + N[(5.0 * eps), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;{x}^{3} \cdot \mathsf{fma}\left(\varepsilon \cdot x, 5, \left(\varepsilon \cdot \varepsilon\right) \cdot 10\right)\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{10}{x}, \varepsilon \cdot \varepsilon, 5 \cdot \varepsilon\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58Initial program 33.3%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites90.8%
Taylor expanded in x around 0
Applied rewrites90.8%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
Applied rewrites98.6%
if 4.49999999999999991e-33 < x Initial program 13.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.3%
Applied rewrites99.3%
Final simplification97.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (* (fma (/ 10.0 x) (* eps eps) (* 5.0 eps)) (* x x)) (* x x))))
(if (<= x -1.45e-58)
t_0
(if (<= x 4.5e-33)
(* (* (fma (fma 5.0 x eps) eps (* (* x x) 10.0)) (* eps eps)) eps)
t_0))))
double code(double x, double eps) {
double t_0 = (fma((10.0 / x), (eps * eps), (5.0 * eps)) * (x * x)) * (x * x);
double tmp;
if (x <= -1.45e-58) {
tmp = t_0;
} else if (x <= 4.5e-33) {
tmp = (fma(fma(5.0, x, eps), eps, ((x * x) * 10.0)) * (eps * eps)) * eps;
} else {
tmp = t_0;
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64(fma(Float64(10.0 / x), Float64(eps * eps), Float64(5.0 * eps)) * Float64(x * x)) * Float64(x * x)) tmp = 0.0 if (x <= -1.45e-58) tmp = t_0; elseif (x <= 4.5e-33) tmp = Float64(Float64(fma(fma(5.0, x, eps), eps, Float64(Float64(x * x) * 10.0)) * Float64(eps * eps)) * eps); else tmp = t_0; end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(10.0 / x), $MachinePrecision] * N[(eps * eps), $MachinePrecision] + N[(5.0 * eps), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.45e-58], t$95$0, If[LessEqual[x, 4.5e-33], N[(N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(N[(x * x), $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(\mathsf{fma}\left(\frac{10}{x}, \varepsilon \cdot \varepsilon, 5 \cdot \varepsilon\right) \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\\
\mathbf{if}\;x \leq -1.45 \cdot 10^{-58}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4.5 \cdot 10^{-33}:\\
\;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, \left(x \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.44999999999999995e-58 or 4.49999999999999991e-33 < x Initial program 27.1%
Taylor expanded in x around -inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.4%
Applied rewrites93.2%
if -1.44999999999999995e-58 < x < 4.49999999999999991e-33Initial program 99.5%
Taylor expanded in eps around inf
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.0%
Taylor expanded in eps around 0
Applied rewrites98.7%
Applied rewrites98.6%
(FPCore (x eps) :precision binary64 (* (* (* (* (* x x) x) x) 5.0) eps))
double code(double x, double eps) {
return ((((x * x) * x) * x) * 5.0) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = ((((x * x) * x) * x) * 5.0d0) * eps
end function
public static double code(double x, double eps) {
return ((((x * x) * x) * x) * 5.0) * eps;
}
def code(x, eps): return ((((x * x) * x) * x) * 5.0) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(Float64(x * x) * x) * x) * 5.0) * eps) end
function tmp = code(x, eps) tmp = ((((x * x) * x) * x) * 5.0) * eps; end
code[x_, eps_] := N[(N[(N[(N[(N[(x * x), $MachinePrecision] * x), $MachinePrecision] * x), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(\left(x \cdot x\right) \cdot x\right) \cdot x\right) \cdot 5\right) \cdot \varepsilon
\end{array}
Initial program 85.6%
lift-+.f64N/A
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower--.f6485.5
Applied rewrites85.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6481.8
Applied rewrites81.8%
Applied rewrites81.8%
Applied rewrites81.8%
Final simplification81.8%
(FPCore (x eps) :precision binary64 (* (* (* (* x x) (* x x)) 5.0) eps))
double code(double x, double eps) {
return (((x * x) * (x * x)) * 5.0) * eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((x * x) * (x * x)) * 5.0d0) * eps
end function
public static double code(double x, double eps) {
return (((x * x) * (x * x)) * 5.0) * eps;
}
def code(x, eps): return (((x * x) * (x * x)) * 5.0) * eps
function code(x, eps) return Float64(Float64(Float64(Float64(x * x) * Float64(x * x)) * 5.0) * eps) end
function tmp = code(x, eps) tmp = (((x * x) * (x * x)) * 5.0) * eps; end
code[x_, eps_] := N[(N[(N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot 5\right) \cdot \varepsilon
\end{array}
Initial program 85.6%
lift-+.f64N/A
flip-+N/A
div-subN/A
frac-2negN/A
frac-2negN/A
sub-divN/A
lower-/.f64N/A
lower--.f64N/A
lower-neg.f64N/A
lower-*.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
lower-neg.f64N/A
lower-neg.f64N/A
lower--.f6485.5
Applied rewrites85.5%
Taylor expanded in eps around 0
*-commutativeN/A
lower-*.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-pow.f6481.8
Applied rewrites81.8%
Applied rewrites81.7%
Final simplification81.7%
(FPCore (x eps) :precision binary64 (* (* (* (* x x) eps) 10.0) (* eps eps)))
double code(double x, double eps) {
return (((x * x) * eps) * 10.0) * (eps * eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (((x * x) * eps) * 10.0d0) * (eps * eps)
end function
public static double code(double x, double eps) {
return (((x * x) * eps) * 10.0) * (eps * eps);
}
def code(x, eps): return (((x * x) * eps) * 10.0) * (eps * eps)
function code(x, eps) return Float64(Float64(Float64(Float64(x * x) * eps) * 10.0) * Float64(eps * eps)) end
function tmp = code(x, eps) tmp = (((x * x) * eps) * 10.0) * (eps * eps); end
code[x_, eps_] := N[(N[(N[(N[(x * x), $MachinePrecision] * eps), $MachinePrecision] * 10.0), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\left(x \cdot x\right) \cdot \varepsilon\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right)
\end{array}
Initial program 85.6%
Taylor expanded in eps around -inf
Applied rewrites72.5%
Taylor expanded in eps around 0
Applied rewrites67.4%
Taylor expanded in eps around inf
Applied rewrites67.5%
Final simplification67.5%
herbie shell --seed 2024270
(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)))