
(FPCore (w l) :precision binary64 (* (exp (- w)) (pow l (exp w))))
double code(double w, double l) {
return exp(-w) * pow(l, exp(w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = exp(-w) * (l ** exp(w))
end function
public static double code(double w, double l) {
return Math.exp(-w) * Math.pow(l, Math.exp(w));
}
def code(w, l): return math.exp(-w) * math.pow(l, math.exp(w))
function code(w, l) return Float64(exp(Float64(-w)) * (l ^ exp(w))) end
function tmp = code(w, l) tmp = exp(-w) * (l ^ exp(w)); end
code[w_, l_] := N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{-w} \cdot {\ell}^{\left(e^{w}\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (w l) :precision binary64 (* (exp (- w)) (pow l (exp w))))
double code(double w, double l) {
return exp(-w) * pow(l, exp(w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = exp(-w) * (l ** exp(w))
end function
public static double code(double w, double l) {
return Math.exp(-w) * Math.pow(l, Math.exp(w));
}
def code(w, l): return math.exp(-w) * math.pow(l, math.exp(w))
function code(w, l) return Float64(exp(Float64(-w)) * (l ^ exp(w))) end
function tmp = code(w, l) tmp = exp(-w) * (l ^ exp(w)); end
code[w_, l_] := N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{-w} \cdot {\ell}^{\left(e^{w}\right)}
\end{array}
(FPCore (w l) :precision binary64 (* (exp (- 0.0 w)) (pow l (exp w))))
double code(double w, double l) {
return exp((0.0 - w)) * pow(l, exp(w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = exp((0.0d0 - w)) * (l ** exp(w))
end function
public static double code(double w, double l) {
return Math.exp((0.0 - w)) * Math.pow(l, Math.exp(w));
}
def code(w, l): return math.exp((0.0 - w)) * math.pow(l, math.exp(w))
function code(w, l) return Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) end
function tmp = code(w, l) tmp = exp((0.0 - w)) * (l ^ exp(w)); end
code[w_, l_] := N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)}
\end{array}
Initial program 99.7%
Final simplification99.7%
(FPCore (w l)
:precision binary64
(let* ((t_0 (* (exp (- 0.0 w)) (pow l (exp w)))))
(if (<= t_0 0.0)
0.0
(if (<= t_0 INFINITY)
(* l (fma w (fma w 0.5 -1.0) 1.0))
(* l (* w (* w (* w -0.16666666666666666))))))))
double code(double w, double l) {
double t_0 = exp((0.0 - w)) * pow(l, exp(w));
double tmp;
if (t_0 <= 0.0) {
tmp = 0.0;
} else if (t_0 <= ((double) INFINITY)) {
tmp = l * fma(w, fma(w, 0.5, -1.0), 1.0);
} else {
tmp = l * (w * (w * (w * -0.16666666666666666)));
}
return tmp;
}
function code(w, l) t_0 = Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) tmp = 0.0 if (t_0 <= 0.0) tmp = 0.0; elseif (t_0 <= Inf) tmp = Float64(l * fma(w, fma(w, 0.5, -1.0), 1.0)); else tmp = Float64(l * Float64(w * Float64(w * Float64(w * -0.16666666666666666)))); end return tmp end
code[w_, l_] := Block[{t$95$0 = N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], 0.0, If[LessEqual[t$95$0, Infinity], N[(l * N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(l * N[(w * N[(w * N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)}\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;0\\
\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;\ell \cdot \mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, -1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(w \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < +inf.0Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6486.7
Simplified86.7%
if +inf.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
Taylor expanded in w around 0
Simplified98.2%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6476.3
Simplified76.3%
Taylor expanded in w around inf
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
distribute-rgt-neg-inN/A
cube-multN/A
unpow2N/A
metadata-evalN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6423.3
Simplified23.3%
Final simplification88.5%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- 0.0 w)) (pow l (exp w))) 0.0) 0.0 (* l (fma w (fma w (fma w -0.16666666666666666 0.5) -1.0) 1.0))))
double code(double w, double l) {
double tmp;
if ((exp((0.0 - w)) * pow(l, exp(w))) <= 0.0) {
tmp = 0.0;
} else {
tmp = l * fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) <= 0.0) tmp = 0.0; else tmp = Float64(l * fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 1.0)); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0], 0.0, N[(l * N[(w * N[(w * N[(w * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)} \leq 0:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \mathsf{fma}\left(w, \mathsf{fma}\left(w, \mathsf{fma}\left(w, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6489.3
Simplified89.3%
Final simplification90.7%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- 0.0 w)) (pow l (exp w))) 0.0) 0.0 (fma w (* l (* w (* w -0.16666666666666666))) l)))
double code(double w, double l) {
double tmp;
if ((exp((0.0 - w)) * pow(l, exp(w))) <= 0.0) {
tmp = 0.0;
} else {
tmp = fma(w, (l * (w * (w * -0.16666666666666666))), l);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) <= 0.0) tmp = 0.0; else tmp = fma(w, Float64(l * Float64(w * Float64(w * -0.16666666666666666))), l); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0], 0.0, N[(w * N[(l * N[(w * N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)} \leq 0:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w, \ell \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right)\right), \ell\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.6
Simplified87.6%
flip-+N/A
/-lowering-/.f64N/A
sub-negN/A
swap-sqrN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
sub-negN/A
accelerator-lowering-fma.f64N/A
metadata-eval88.1
Applied egg-rr88.1%
Taylor expanded in w around inf
*-commutativeN/A
associate-*l*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6488.1
Simplified88.1%
Final simplification89.6%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- 0.0 w)) (pow l (exp w))) 0.0) 0.0 (* l (fma w (fma w 0.5 -1.0) 1.0))))
double code(double w, double l) {
double tmp;
if ((exp((0.0 - w)) * pow(l, exp(w))) <= 0.0) {
tmp = 0.0;
} else {
tmp = l * fma(w, fma(w, 0.5, -1.0), 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) <= 0.0) tmp = 0.0; else tmp = Float64(l * fma(w, fma(w, 0.5, -1.0), 1.0)); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0], 0.0, N[(l * N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)} \leq 0:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, -1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f6486.7
Simplified86.7%
Final simplification88.5%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- 0.0 w)) (pow l (exp w))) 0.0) 0.0 l))
double code(double w, double l) {
double tmp;
if ((exp((0.0 - w)) * pow(l, exp(w))) <= 0.0) {
tmp = 0.0;
} else {
tmp = l;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if ((exp((0.0d0 - w)) * (l ** exp(w))) <= 0.0d0) then
tmp = 0.0d0
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((Math.exp((0.0 - w)) * Math.pow(l, Math.exp(w))) <= 0.0) {
tmp = 0.0;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp((0.0 - w)) * math.pow(l, math.exp(w))) <= 0.0: tmp = 0.0 else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(0.0 - w)) * (l ^ exp(w))) <= 0.0) tmp = 0.0; else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp((0.0 - w)) * (l ^ exp(w))) <= 0.0) tmp = 0.0; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 0.0], 0.0, l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{0 - w} \cdot {\ell}^{\left(e^{w}\right)} \leq 0:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
Taylor expanded in w around 0
Simplified66.7%
Final simplification71.1%
(FPCore (w l) :precision binary64 (/ l (exp w)))
double code(double w, double l) {
return l / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l / exp(w)
end function
public static double code(double w, double l) {
return l / Math.exp(w);
}
def code(w, l): return l / math.exp(w)
function code(w, l) return Float64(l / exp(w)) end
function tmp = code(w, l) tmp = l / exp(w); end
code[w_, l_] := N[(l / N[Exp[w], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{e^{w}}
\end{array}
Initial program 99.7%
Taylor expanded in w around 0
Simplified98.2%
*-commutativeN/A
exp-negN/A
un-div-invN/A
/-lowering-/.f64N/A
exp-lowering-exp.f6498.2
Applied egg-rr98.2%
(FPCore (w l) :precision binary64 (if (<= w -0.7) (exp (- 0.0 w)) (if (<= w 0.21) (/ (* l (- 1.0 (* w w))) (+ w 1.0)) 0.0)))
double code(double w, double l) {
double tmp;
if (w <= -0.7) {
tmp = exp((0.0 - w));
} else if (w <= 0.21) {
tmp = (l * (1.0 - (w * w))) / (w + 1.0);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-0.7d0)) then
tmp = exp((0.0d0 - w))
else if (w <= 0.21d0) then
tmp = (l * (1.0d0 - (w * w))) / (w + 1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.7) {
tmp = Math.exp((0.0 - w));
} else if (w <= 0.21) {
tmp = (l * (1.0 - (w * w))) / (w + 1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.7: tmp = math.exp((0.0 - w)) elif w <= 0.21: tmp = (l * (1.0 - (w * w))) / (w + 1.0) else: tmp = 0.0 return tmp
function code(w, l) tmp = 0.0 if (w <= -0.7) tmp = exp(Float64(0.0 - w)); elseif (w <= 0.21) tmp = Float64(Float64(l * Float64(1.0 - Float64(w * w))) / Float64(w + 1.0)); else tmp = 0.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.7) tmp = exp((0.0 - w)); elseif (w <= 0.21) tmp = (l * (1.0 - (w * w))) / (w + 1.0); else tmp = 0.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.7], N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision], If[LessEqual[w, 0.21], N[(N[(l * N[(1.0 - N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(w + 1.0), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7:\\
\;\;\;\;e^{0 - w}\\
\mathbf{elif}\;w \leq 0.21:\\
\;\;\;\;\frac{\ell \cdot \left(1 - w \cdot w\right)}{w + 1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -0.69999999999999996Initial program 100.0%
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.8
Applied egg-rr98.8%
if -0.69999999999999996 < w < 0.209999999999999992Initial program 99.6%
Taylor expanded in w around 0
Simplified97.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
--lowering--.f6497.5
Simplified97.5%
flip--N/A
associate-*l/N/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
metadata-evalN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f6497.5
Applied egg-rr97.5%
if 0.209999999999999992 < w Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
Final simplification98.2%
(FPCore (w l) :precision binary64 (* (exp (- 0.0 w)) l))
double code(double w, double l) {
return exp((0.0 - w)) * l;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = exp((0.0d0 - w)) * l
end function
public static double code(double w, double l) {
return Math.exp((0.0 - w)) * l;
}
def code(w, l): return math.exp((0.0 - w)) * l
function code(w, l) return Float64(exp(Float64(0.0 - w)) * l) end
function tmp = code(w, l) tmp = exp((0.0 - w)) * l; end
code[w_, l_] := N[(N[Exp[N[(0.0 - w), $MachinePrecision]], $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}
\\
e^{0 - w} \cdot \ell
\end{array}
Initial program 99.7%
Taylor expanded in w around 0
Simplified98.2%
Final simplification98.2%
(FPCore (w l)
:precision binary64
(if (<= w 0.22)
(fma
w
(-
(*
(* w l)
(/
(-
(* (* (* w w) 0.027777777777777776) (fma w -0.16666666666666666 -0.5))
(* (fma w -0.16666666666666666 -0.5) 0.25))
0.25))
l)
l)
0.0))
double code(double w, double l) {
double tmp;
if (w <= 0.22) {
tmp = fma(w, (((w * l) * (((((w * w) * 0.027777777777777776) * fma(w, -0.16666666666666666, -0.5)) - (fma(w, -0.16666666666666666, -0.5) * 0.25)) / 0.25)) - l), l);
} else {
tmp = 0.0;
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= 0.22) tmp = fma(w, Float64(Float64(Float64(w * l) * Float64(Float64(Float64(Float64(Float64(w * w) * 0.027777777777777776) * fma(w, -0.16666666666666666, -0.5)) - Float64(fma(w, -0.16666666666666666, -0.5) * 0.25)) / 0.25)) - l), l); else tmp = 0.0; end return tmp end
code[w_, l_] := If[LessEqual[w, 0.22], N[(w * N[(N[(N[(w * l), $MachinePrecision] * N[(N[(N[(N[(N[(w * w), $MachinePrecision] * 0.027777777777777776), $MachinePrecision] * N[(w * -0.16666666666666666 + -0.5), $MachinePrecision]), $MachinePrecision] - N[(N[(w * -0.16666666666666666 + -0.5), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision] / 0.25), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision] + l), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.22:\\
\;\;\;\;\mathsf{fma}\left(w, \left(w \cdot \ell\right) \cdot \frac{\left(\left(w \cdot w\right) \cdot 0.027777777777777776\right) \cdot \mathsf{fma}\left(w, -0.16666666666666666, -0.5\right) - \mathsf{fma}\left(w, -0.16666666666666666, -0.5\right) \cdot 0.25}{0.25} - \ell, \ell\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < 0.220000000000000001Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
associate-*r*N/A
*-commutativeN/A
distribute-lft-outN/A
+-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.6
Simplified87.6%
flip-+N/A
div-subN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr74.0%
Taylor expanded in w around 0
Simplified91.0%
if 0.220000000000000001 < w Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
Final simplification92.2%
(FPCore (w l) :precision binary64 (if (<= w 0.17) (* l (- 1.0 w)) 0.0))
double code(double w, double l) {
double tmp;
if (w <= 0.17) {
tmp = l * (1.0 - w);
} else {
tmp = 0.0;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 0.17d0) then
tmp = l * (1.0d0 - w)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 0.17) {
tmp = l * (1.0 - w);
} else {
tmp = 0.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 0.17: tmp = l * (1.0 - w) else: tmp = 0.0 return tmp
function code(w, l) tmp = 0.0 if (w <= 0.17) tmp = Float64(l * Float64(1.0 - w)); else tmp = 0.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 0.17) tmp = l * (1.0 - w); else tmp = 0.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 0.17], N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.17:\\
\;\;\;\;\ell \cdot \left(1 - w\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < 0.170000000000000012Initial program 99.7%
Taylor expanded in w around 0
Simplified97.9%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
--lowering--.f6475.2
Simplified75.2%
if 0.170000000000000012 < w Initial program 100.0%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr100.0%
Final simplification78.5%
(FPCore (w l) :precision binary64 0.0)
double code(double w, double l) {
return 0.0;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = 0.0d0
end function
public static double code(double w, double l) {
return 0.0;
}
def code(w, l): return 0.0
function code(w, l) return 0.0 end
function tmp = code(w, l) tmp = 0.0; end
code[w_, l_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.7%
exp-negN/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
mul0-lftN/A
*-commutativeN/A
*-commutativeN/A
mul0-lftN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-evalN/A
associate-/r/N/A
div-invN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
Applied egg-rr16.0%
herbie shell --seed 2024198
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))