
(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 14 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
(let* ((t_0 (pow l (exp w))))
(if (<= (* (exp (- w)) t_0) INFINITY)
(* t_0 (exp (* (* w w) (/ -1.0 w))))
(pow l (+ w 1.0)))))
double code(double w, double l) {
double t_0 = pow(l, exp(w));
double tmp;
if ((exp(-w) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * exp(((w * w) * (-1.0 / w)));
} else {
tmp = pow(l, (w + 1.0));
}
return tmp;
}
public static double code(double w, double l) {
double t_0 = Math.pow(l, Math.exp(w));
double tmp;
if ((Math.exp(-w) * t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * Math.exp(((w * w) * (-1.0 / w)));
} else {
tmp = Math.pow(l, (w + 1.0));
}
return tmp;
}
def code(w, l): t_0 = math.pow(l, math.exp(w)) tmp = 0 if (math.exp(-w) * t_0) <= math.inf: tmp = t_0 * math.exp(((w * w) * (-1.0 / w))) else: tmp = math.pow(l, (w + 1.0)) return tmp
function code(w, l) t_0 = l ^ exp(w) tmp = 0.0 if (Float64(exp(Float64(-w)) * t_0) <= Inf) tmp = Float64(t_0 * exp(Float64(Float64(w * w) * Float64(-1.0 / w)))); else tmp = l ^ Float64(w + 1.0); end return tmp end
function tmp_2 = code(w, l) t_0 = l ^ exp(w); tmp = 0.0; if ((exp(-w) * t_0) <= Inf) tmp = t_0 * exp(((w * w) * (-1.0 / w))); else tmp = l ^ (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * t$95$0), $MachinePrecision], Infinity], N[(t$95$0 * N[Exp[N[(N[(w * w), $MachinePrecision] * N[(-1.0 / w), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{\left(e^{w}\right)}\\
\mathbf{if}\;e^{-w} \cdot t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot e^{\left(w \cdot w\right) \cdot \frac{-1}{w}}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(w + 1\right)}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < +inf.0Initial program 99.7%
Taylor expanded in l around -inf
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
mul-1-negN/A
unsub-negN/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6499.6
Simplified99.6%
neg-sub0N/A
flip--N/A
div-invN/A
lower-*.f64N/A
metadata-evalN/A
neg-sub0N/A
lower-neg.f64N/A
lower-*.f64N/A
+-lft-identityN/A
lower-/.f6499.6
Applied egg-rr99.6%
associate-/r/N/A
metadata-evalN/A
*-lft-identity99.7
Applied egg-rr99.7%
if +inf.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 0.0%
Taylor expanded in w around 0
Simplified100.0%
Taylor expanded in w around 0
+-commutativeN/A
lower-+.f64100.0
Simplified100.0%
Final simplification99.7%
(FPCore (w l) :precision binary64 (let* ((t_0 (* (exp (- w)) (pow l (exp w))))) (if (<= t_0 INFINITY) t_0 (pow l (+ w 1.0)))))
double code(double w, double l) {
double t_0 = exp(-w) * pow(l, exp(w));
double tmp;
if (t_0 <= ((double) INFINITY)) {
tmp = t_0;
} else {
tmp = pow(l, (w + 1.0));
}
return tmp;
}
public static double code(double w, double l) {
double t_0 = Math.exp(-w) * Math.pow(l, Math.exp(w));
double tmp;
if (t_0 <= Double.POSITIVE_INFINITY) {
tmp = t_0;
} else {
tmp = Math.pow(l, (w + 1.0));
}
return tmp;
}
def code(w, l): t_0 = math.exp(-w) * math.pow(l, math.exp(w)) tmp = 0 if t_0 <= math.inf: tmp = t_0 else: tmp = math.pow(l, (w + 1.0)) return tmp
function code(w, l) t_0 = Float64(exp(Float64(-w)) * (l ^ exp(w))) tmp = 0.0 if (t_0 <= Inf) tmp = t_0; else tmp = l ^ Float64(w + 1.0); end return tmp end
function tmp_2 = code(w, l) t_0 = exp(-w) * (l ^ exp(w)); tmp = 0.0; if (t_0 <= Inf) tmp = t_0; else tmp = l ^ (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, Infinity], t$95$0, N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-w} \cdot {\ell}^{\left(e^{w}\right)}\\
\mathbf{if}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(w + 1\right)}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < +inf.0Initial program 99.7%
if +inf.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 0.0%
Taylor expanded in w around 0
Simplified100.0%
Taylor expanded in w around 0
+-commutativeN/A
lower-+.f64100.0
Simplified100.0%
Final simplification99.7%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1e-157) 0.0 (fma w (fma w (fma w -0.16666666666666666 0.5) -1.0) 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1e-157) {
tmp = 0.0;
} else {
tmp = 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(-w)) * (l ^ exp(w))) <= 1e-157) tmp = 0.0; else tmp = 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[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-157], 0.0, N[(w * N[(w * N[(w * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\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))) < 9.99999999999999943e-158Initial program 99.7%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr60.4%
if 9.99999999999999943e-158 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 97.0%
lift-exp.f64N/A
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-eval41.6
Applied egg-rr41.6%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6430.8
Simplified30.8%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1e-157) 0.0 (fma w (fma w 0.5 -1.0) 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1e-157) {
tmp = 0.0;
} else {
tmp = fma(w, fma(w, 0.5, -1.0), 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 1e-157) tmp = 0.0; else tmp = fma(w, fma(w, 0.5, -1.0), 1.0); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-157], 0.0, N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\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))) < 9.99999999999999943e-158Initial program 99.7%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr60.4%
if 9.99999999999999943e-158 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 97.0%
lift-exp.f64N/A
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-eval41.6
Applied egg-rr41.6%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
*-commutativeN/A
lower-fma.f6424.8
Simplified24.8%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1e-157) 0.0 (- 1.0 w)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1e-157) {
tmp = 0.0;
} else {
tmp = 1.0 - w;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if ((exp(-w) * (l ** exp(w))) <= 1d-157) then
tmp = 0.0d0
else
tmp = 1.0d0 - w
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((Math.exp(-w) * Math.pow(l, Math.exp(w))) <= 1e-157) {
tmp = 0.0;
} else {
tmp = 1.0 - w;
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp(-w) * math.pow(l, math.exp(w))) <= 1e-157: tmp = 0.0 else: tmp = 1.0 - w return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 1e-157) tmp = 0.0; else tmp = Float64(1.0 - w); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp(-w) * (l ^ exp(w))) <= 1e-157) tmp = 0.0; else tmp = 1.0 - w; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-157], 0.0, N[(1.0 - w), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 - w\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 9.99999999999999943e-158Initial program 99.7%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr60.4%
if 9.99999999999999943e-158 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 97.0%
lift-exp.f64N/A
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-eval41.6
Applied egg-rr41.6%
Taylor expanded in w around 0
neg-mul-1N/A
sub-negN/A
lower--.f645.8
Simplified5.8%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1.12e-154) 0.0 1.0))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1.12e-154) {
tmp = 0.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if ((exp(-w) * (l ** exp(w))) <= 1.12d-154) then
tmp = 0.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((Math.exp(-w) * Math.pow(l, Math.exp(w))) <= 1.12e-154) {
tmp = 0.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp(-w) * math.pow(l, math.exp(w))) <= 1.12e-154: tmp = 0.0 else: tmp = 1.0 return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 1.12e-154) tmp = 0.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp(-w) * (l ^ exp(w))) <= 1.12e-154) tmp = 0.0; else tmp = 1.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.12e-154], 0.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 1.12 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 1.12e-154Initial program 99.7%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr60.4%
if 1.12e-154 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 97.0%
lift-exp.f64N/A
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-eval41.6
Applied egg-rr41.6%
Taylor expanded in w around 0
Simplified5.0%
(FPCore (w l)
:precision binary64
(if (<= l 0.3)
(*
(- 1.0 w)
(pow l (fma w (fma w (fma w 0.16666666666666666 0.5) 1.0) 1.0)))
(* (fma w (fma w 0.5 -1.0) 1.0) (pow l (fma w (fma w 0.5 1.0) 1.0)))))
double code(double w, double l) {
double tmp;
if (l <= 0.3) {
tmp = (1.0 - w) * pow(l, fma(w, fma(w, fma(w, 0.16666666666666666, 0.5), 1.0), 1.0));
} else {
tmp = fma(w, fma(w, 0.5, -1.0), 1.0) * pow(l, fma(w, fma(w, 0.5, 1.0), 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (l <= 0.3) tmp = Float64(Float64(1.0 - w) * (l ^ fma(w, fma(w, fma(w, 0.16666666666666666, 0.5), 1.0), 1.0))); else tmp = Float64(fma(w, fma(w, 0.5, -1.0), 1.0) * (l ^ fma(w, fma(w, 0.5, 1.0), 1.0))); end return tmp end
code[w_, l_] := If[LessEqual[l, 0.3], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(w * N[(w * N[(w * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[l, N[(w * N[(w * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.3:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.16666666666666666, 0.5\right), 1\right), 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, -1\right), 1\right) \cdot {\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, 1\right), 1\right)\right)}\\
\end{array}
\end{array}
if l < 0.299999999999999989Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6476.4
Simplified76.4%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6498.9
Simplified98.9%
if 0.299999999999999989 < l Initial program 95.2%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6485.5
Simplified85.5%
Taylor expanded in w around 0
+-commutativeN/A
metadata-evalN/A
cancel-sign-sub-invN/A
lower-fma.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6498.3
Simplified98.3%
(FPCore (w l)
:precision binary64
(if (<= l 0.3)
(*
(- 1.0 w)
(pow l (fma w (fma w (fma w 0.16666666666666666 0.5) 1.0) 1.0)))
(pow l (fma w (fma w 0.5 1.0) 1.0))))
double code(double w, double l) {
double tmp;
if (l <= 0.3) {
tmp = (1.0 - w) * pow(l, fma(w, fma(w, fma(w, 0.16666666666666666, 0.5), 1.0), 1.0));
} else {
tmp = pow(l, fma(w, fma(w, 0.5, 1.0), 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (l <= 0.3) tmp = Float64(Float64(1.0 - w) * (l ^ fma(w, fma(w, fma(w, 0.16666666666666666, 0.5), 1.0), 1.0))); else tmp = l ^ fma(w, fma(w, 0.5, 1.0), 1.0); end return tmp end
code[w_, l_] := If[LessEqual[l, 0.3], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(w * N[(w * N[(w * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Power[l, N[(w * N[(w * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.3:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.16666666666666666, 0.5\right), 1\right), 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, 1\right), 1\right)\right)}\\
\end{array}
\end{array}
if l < 0.299999999999999989Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6476.4
Simplified76.4%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6498.9
Simplified98.9%
if 0.299999999999999989 < l Initial program 95.2%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6463.2
Simplified63.2%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.6
Simplified93.6%
Taylor expanded in w around 0
Simplified97.9%
Final simplification98.5%
(FPCore (w l) :precision binary64 (if (<= l 0.3) (* (pow l (+ w 1.0)) (- 1.0 w)) (pow l (fma w (fma w 0.5 1.0) 1.0))))
double code(double w, double l) {
double tmp;
if (l <= 0.3) {
tmp = pow(l, (w + 1.0)) * (1.0 - w);
} else {
tmp = pow(l, fma(w, fma(w, 0.5, 1.0), 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (l <= 0.3) tmp = Float64((l ^ Float64(w + 1.0)) * Float64(1.0 - w)); else tmp = l ^ fma(w, fma(w, 0.5, 1.0), 1.0); end return tmp end
code[w_, l_] := If[LessEqual[l, 0.3], N[(N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision] * N[(1.0 - w), $MachinePrecision]), $MachinePrecision], N[Power[l, N[(w * N[(w * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.3:\\
\;\;\;\;{\ell}^{\left(w + 1\right)} \cdot \left(1 - w\right)\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, 1\right), 1\right)\right)}\\
\end{array}
\end{array}
if l < 0.299999999999999989Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6476.4
Simplified76.4%
Taylor expanded in w around 0
+-commutativeN/A
lower-+.f6498.6
Simplified98.6%
if 0.299999999999999989 < l Initial program 95.2%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6463.2
Simplified63.2%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.6
Simplified93.6%
Taylor expanded in w around 0
Simplified97.9%
Final simplification98.3%
(FPCore (w l) :precision binary64 (if (<= w -0.98) (exp (- w)) (pow l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -0.98) {
tmp = exp(-w);
} else {
tmp = pow(l, (w + 1.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.98d0)) then
tmp = exp(-w)
else
tmp = l ** (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.98) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, (w + 1.0));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.98: tmp = math.exp(-w) else: tmp = math.pow(l, (w + 1.0)) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.98) tmp = exp(Float64(-w)); else tmp = l ^ Float64(w + 1.0); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.98) tmp = exp(-w); else tmp = l ^ (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.98], N[Exp[(-w)], $MachinePrecision], N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.98:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(w + 1\right)}\\
\end{array}
\end{array}
if w < -0.97999999999999998Initial program 99.9%
lift-exp.f64N/A
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%
lift-neg.f64N/A
lift-exp.f64N/A
*-rgt-identity98.8
Applied egg-rr98.8%
if -0.97999999999999998 < w Initial program 96.9%
Taylor expanded in w around 0
Simplified97.8%
Taylor expanded in w around 0
+-commutativeN/A
lower-+.f6497.7
Simplified97.7%
Final simplification98.0%
(FPCore (w l) :precision binary64 (if (<= w -0.7) (exp (- w)) (if (<= w 0.095) l 0.0)))
double code(double w, double l) {
double tmp;
if (w <= -0.7) {
tmp = exp(-w);
} else if (w <= 0.095) {
tmp = l;
} 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(-w)
else if (w <= 0.095d0) then
tmp = l
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(-w);
} else if (w <= 0.095) {
tmp = l;
} else {
tmp = 0.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.7: tmp = math.exp(-w) elif w <= 0.095: tmp = l else: tmp = 0.0 return tmp
function code(w, l) tmp = 0.0 if (w <= -0.7) tmp = exp(Float64(-w)); elseif (w <= 0.095) tmp = l; else tmp = 0.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.7) tmp = exp(-w); elseif (w <= 0.095) tmp = l; else tmp = 0.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.7], N[Exp[(-w)], $MachinePrecision], If[LessEqual[w, 0.095], l, 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7:\\
\;\;\;\;e^{-w}\\
\mathbf{elif}\;w \leq 0.095:\\
\;\;\;\;\ell\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -0.69999999999999996Initial program 99.9%
lift-exp.f64N/A
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%
lift-neg.f64N/A
lift-exp.f64N/A
*-rgt-identity98.8
Applied egg-rr98.8%
if -0.69999999999999996 < w < 0.095000000000000001Initial program 99.5%
Taylor expanded in w around 0
Simplified97.1%
Taylor expanded in w around 0
Simplified96.4%
if 0.095000000000000001 < w Initial program 89.1%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr89.3%
Final simplification95.8%
(FPCore (w l) :precision binary64 (if (<= w -0.7) (exp (- w)) (if (<= w 0.095) (/ 1.0 (/ 1.0 l)) 0.0)))
double code(double w, double l) {
double tmp;
if (w <= -0.7) {
tmp = exp(-w);
} else if (w <= 0.095) {
tmp = 1.0 / (1.0 / l);
} 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(-w)
else if (w <= 0.095d0) then
tmp = 1.0d0 / (1.0d0 / l)
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(-w);
} else if (w <= 0.095) {
tmp = 1.0 / (1.0 / l);
} else {
tmp = 0.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.7: tmp = math.exp(-w) elif w <= 0.095: tmp = 1.0 / (1.0 / l) else: tmp = 0.0 return tmp
function code(w, l) tmp = 0.0 if (w <= -0.7) tmp = exp(Float64(-w)); elseif (w <= 0.095) tmp = Float64(1.0 / Float64(1.0 / l)); else tmp = 0.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.7) tmp = exp(-w); elseif (w <= 0.095) tmp = 1.0 / (1.0 / l); else tmp = 0.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.7], N[Exp[(-w)], $MachinePrecision], If[LessEqual[w, 0.095], N[(1.0 / N[(1.0 / l), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7:\\
\;\;\;\;e^{-w}\\
\mathbf{elif}\;w \leq 0.095:\\
\;\;\;\;\frac{1}{\frac{1}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -0.69999999999999996Initial program 99.9%
lift-exp.f64N/A
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%
lift-neg.f64N/A
lift-exp.f64N/A
*-rgt-identity98.8
Applied egg-rr98.8%
if -0.69999999999999996 < w < 0.095000000000000001Initial program 99.5%
Taylor expanded in l around -inf
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
mul-1-negN/A
unsub-negN/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6499.3
Simplified99.3%
exp-negN/A
lift-exp.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
lift-pow.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.3
Applied egg-rr99.3%
Taylor expanded in w around 0
lower-/.f6496.2
Simplified96.2%
if 0.095000000000000001 < w Initial program 89.1%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr89.3%
(FPCore (w l) :precision binary64 (if (<= w -1.06e+39) (fma w (fma w (fma w -0.16666666666666666 0.5) -1.0) 1.0) (if (<= w 0.095) (/ 1.0 (/ 1.0 l)) 0.0)))
double code(double w, double l) {
double tmp;
if (w <= -1.06e+39) {
tmp = fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 1.0);
} else if (w <= 0.095) {
tmp = 1.0 / (1.0 / l);
} else {
tmp = 0.0;
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.06e+39) tmp = fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 1.0); elseif (w <= 0.095) tmp = Float64(1.0 / Float64(1.0 / l)); else tmp = 0.0; end return tmp end
code[w_, l_] := If[LessEqual[w, -1.06e+39], N[(w * N[(w * N[(w * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[w, 0.095], N[(1.0 / N[(1.0 / l), $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.06 \cdot 10^{+39}:\\
\;\;\;\;\mathsf{fma}\left(w, \mathsf{fma}\left(w, \mathsf{fma}\left(w, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\mathbf{elif}\;w \leq 0.095:\\
\;\;\;\;\frac{1}{\frac{1}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -1.06000000000000005e39Initial program 100.0%
lift-exp.f64N/A
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-eval100.0
Applied egg-rr100.0%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6477.9
Simplified77.9%
if -1.06000000000000005e39 < w < 0.095000000000000001Initial program 99.5%
Taylor expanded in l around -inf
lower-*.f64N/A
lower-exp.f64N/A
lower-neg.f64N/A
*-commutativeN/A
exp-prodN/A
lower-pow.f64N/A
mul-1-negN/A
unsub-negN/A
exp-diffN/A
rem-exp-logN/A
lower-/.f64N/A
rem-exp-logN/A
lower-/.f64N/A
lower-exp.f6499.3
Simplified99.3%
exp-negN/A
lift-exp.f64N/A
lift-/.f64N/A
lift-/.f64N/A
lift-exp.f64N/A
lift-pow.f64N/A
associate-*l/N/A
lift-/.f64N/A
lift-/.f64N/A
associate-/r/N/A
metadata-evalN/A
*-lft-identityN/A
*-lft-identityN/A
clear-numN/A
lower-/.f64N/A
lower-/.f6499.3
Applied egg-rr99.3%
Taylor expanded in w around 0
lower-/.f6491.8
Simplified91.8%
if 0.095000000000000001 < w Initial program 89.1%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr89.3%
(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 97.8%
exp-negN/A
lift-exp.f64N/A
lift-exp.f64N/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
Applied egg-rr18.4%
herbie shell --seed 2024207
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))