
(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 10 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 (/ (pow (pow l (sqrt (exp w))) (exp (* w 0.5))) (exp w)))
double code(double w, double l) {
return pow(pow(l, sqrt(exp(w))), exp((w * 0.5))) / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = ((l ** sqrt(exp(w))) ** exp((w * 0.5d0))) / exp(w)
end function
public static double code(double w, double l) {
return Math.pow(Math.pow(l, Math.sqrt(Math.exp(w))), Math.exp((w * 0.5))) / Math.exp(w);
}
def code(w, l): return math.pow(math.pow(l, math.sqrt(math.exp(w))), math.exp((w * 0.5))) / math.exp(w)
function code(w, l) return Float64(((l ^ sqrt(exp(w))) ^ exp(Float64(w * 0.5))) / exp(w)) end
function tmp = code(w, l) tmp = ((l ^ sqrt(exp(w))) ^ exp((w * 0.5))) / exp(w); end
code[w_, l_] := N[(N[Power[N[Power[l, N[Sqrt[N[Exp[w], $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Exp[N[(w * 0.5), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\left({\ell}^{\left(\sqrt{e^{w}}\right)}\right)}^{\left(e^{w \cdot 0.5}\right)}}{e^{w}}
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
add-sqr-sqrt99.3%
pow-unpow99.4%
pow-to-exp94.5%
Applied egg-rr94.5%
exp-to-pow99.4%
Simplified99.4%
pow1/299.4%
pow-exp99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (w l) :precision binary64 (let* ((t_0 (exp (* w 0.5)))) (/ (pow (pow l t_0) t_0) (exp w))))
double code(double w, double l) {
double t_0 = exp((w * 0.5));
return pow(pow(l, t_0), t_0) / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: t_0
t_0 = exp((w * 0.5d0))
code = ((l ** t_0) ** t_0) / exp(w)
end function
public static double code(double w, double l) {
double t_0 = Math.exp((w * 0.5));
return Math.pow(Math.pow(l, t_0), t_0) / Math.exp(w);
}
def code(w, l): t_0 = math.exp((w * 0.5)) return math.pow(math.pow(l, t_0), t_0) / math.exp(w)
function code(w, l) t_0 = exp(Float64(w * 0.5)) return Float64(((l ^ t_0) ^ t_0) / exp(w)) end
function tmp = code(w, l) t_0 = exp((w * 0.5)); tmp = ((l ^ t_0) ^ t_0) / exp(w); end
code[w_, l_] := Block[{t$95$0 = N[Exp[N[(w * 0.5), $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[Power[l, t$95$0], $MachinePrecision], t$95$0], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{w \cdot 0.5}\\
\frac{{\left({\ell}^{t\_0}\right)}^{t\_0}}{e^{w}}
\end{array}
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
add-sqr-sqrt99.3%
pow-unpow99.4%
pow-to-exp94.5%
Applied egg-rr94.5%
exp-to-pow99.4%
Simplified99.4%
pow1/299.4%
pow-exp99.4%
Applied egg-rr99.4%
pow1/299.4%
pow-exp99.4%
Applied egg-rr99.4%
Final simplification99.4%
(FPCore (w l) :precision binary64 (/ (pow l (exp w)) (exp w)))
double code(double w, double l) {
return pow(l, exp(w)) / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = (l ** exp(w)) / exp(w)
end function
public static double code(double w, double l) {
return Math.pow(l, Math.exp(w)) / Math.exp(w);
}
def code(w, l): return math.pow(l, math.exp(w)) / math.exp(w)
function code(w, l) return Float64((l ^ exp(w)) / exp(w)) end
function tmp = code(w, l) tmp = (l ^ exp(w)) / exp(w); end
code[w_, l_] := N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (w l)
:precision binary64
(if (<= w -0.098)
(exp (- w))
(if (<= w 0.68)
(+ l (* (* l w) (+ (log l) -1.0)))
(exp (- (* w (log l)) w)))))
double code(double w, double l) {
double tmp;
if (w <= -0.098) {
tmp = exp(-w);
} else if (w <= 0.68) {
tmp = l + ((l * w) * (log(l) + -1.0));
} else {
tmp = exp(((w * log(l)) - w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-0.098d0)) then
tmp = exp(-w)
else if (w <= 0.68d0) then
tmp = l + ((l * w) * (log(l) + (-1.0d0)))
else
tmp = exp(((w * log(l)) - w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.098) {
tmp = Math.exp(-w);
} else if (w <= 0.68) {
tmp = l + ((l * w) * (Math.log(l) + -1.0));
} else {
tmp = Math.exp(((w * Math.log(l)) - w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.098: tmp = math.exp(-w) elif w <= 0.68: tmp = l + ((l * w) * (math.log(l) + -1.0)) else: tmp = math.exp(((w * math.log(l)) - w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.098) tmp = exp(Float64(-w)); elseif (w <= 0.68) tmp = Float64(l + Float64(Float64(l * w) * Float64(log(l) + -1.0))); else tmp = exp(Float64(Float64(w * log(l)) - w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.098) tmp = exp(-w); elseif (w <= 0.68) tmp = l + ((l * w) * (log(l) + -1.0)); else tmp = exp(((w * log(l)) - w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.098], N[Exp[(-w)], $MachinePrecision], If[LessEqual[w, 0.68], N[(l + N[(N[(l * w), $MachinePrecision] * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.098:\\
\;\;\;\;e^{-w}\\
\mathbf{elif}\;w \leq 0.68:\\
\;\;\;\;\ell + \left(\ell \cdot w\right) \cdot \left(\log \ell + -1\right)\\
\mathbf{else}:\\
\;\;\;\;e^{w \cdot \log \ell - w}\\
\end{array}
\end{array}
if w < -0.098000000000000004Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.098000000000000004 < w < 0.680000000000000049Initial program 99.6%
exp-neg99.6%
remove-double-neg99.6%
associate-*l/99.6%
*-lft-identity99.6%
remove-double-neg99.6%
Simplified99.6%
Taylor expanded in w around 0 97.5%
+-commutative97.5%
fma-define97.5%
sub-neg97.5%
*-commutative97.5%
neg-mul-197.5%
distribute-rgt-out97.5%
Simplified97.5%
fma-undefine97.5%
associate-*r*98.2%
Applied egg-rr98.2%
if 0.680000000000000049 < w Initial program 97.6%
exp-neg97.6%
remove-double-neg97.6%
associate-*l/97.6%
*-lft-identity97.6%
remove-double-neg97.6%
Simplified97.6%
Taylor expanded in l around inf 97.6%
mul-1-neg97.6%
distribute-rgt-neg-in97.6%
log-rec97.6%
remove-double-neg97.6%
+-rgt-identity97.6%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around 0 100.0%
distribute-rgt1-in100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
Final simplification99.0%
(FPCore (w l) :precision binary64 (let* ((t_0 (exp (- w)))) (if (<= w -9e+15) t_0 (* t_0 (pow l (+ w 1.0))))))
double code(double w, double l) {
double t_0 = exp(-w);
double tmp;
if (w <= -9e+15) {
tmp = t_0;
} else {
tmp = t_0 * 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) :: t_0
real(8) :: tmp
t_0 = exp(-w)
if (w <= (-9d+15)) then
tmp = t_0
else
tmp = t_0 * (l ** (w + 1.0d0))
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = Math.exp(-w);
double tmp;
if (w <= -9e+15) {
tmp = t_0;
} else {
tmp = t_0 * Math.pow(l, (w + 1.0));
}
return tmp;
}
def code(w, l): t_0 = math.exp(-w) tmp = 0 if w <= -9e+15: tmp = t_0 else: tmp = t_0 * math.pow(l, (w + 1.0)) return tmp
function code(w, l) t_0 = exp(Float64(-w)) tmp = 0.0 if (w <= -9e+15) tmp = t_0; else tmp = Float64(t_0 * (l ^ Float64(w + 1.0))); end return tmp end
function tmp_2 = code(w, l) t_0 = exp(-w); tmp = 0.0; if (w <= -9e+15) tmp = t_0; else tmp = t_0 * (l ^ (w + 1.0)); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[Exp[(-w)], $MachinePrecision]}, If[LessEqual[w, -9e+15], t$95$0, N[(t$95$0 * N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-w}\\
\mathbf{if}\;w \leq -9 \cdot 10^{+15}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot {\ell}^{\left(w + 1\right)}\\
\end{array}
\end{array}
if w < -9e15Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -9e15 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in l around inf 92.5%
mul-1-neg92.5%
distribute-rgt-neg-in92.5%
log-rec92.5%
remove-double-neg92.5%
+-rgt-identity92.5%
exp-diff93.0%
+-rgt-identity93.0%
remove-double-neg93.0%
distribute-lft-neg-in93.0%
distribute-rgt-neg-out93.0%
Simplified93.0%
Taylor expanded in w around 0 92.6%
distribute-rgt1-in92.6%
Simplified92.6%
sub-neg92.6%
exp-sum92.0%
*-commutative92.0%
exp-to-pow98.6%
Applied egg-rr98.6%
Final simplification99.0%
(FPCore (w l) :precision binary64 (if (<= w -9e+15) (exp (- w)) (/ (pow l (+ w 1.0)) (exp w))))
double code(double w, double l) {
double tmp;
if (w <= -9e+15) {
tmp = exp(-w);
} else {
tmp = pow(l, (w + 1.0)) / exp(w);
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-9d+15)) then
tmp = exp(-w)
else
tmp = (l ** (w + 1.0d0)) / exp(w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -9e+15) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, (w + 1.0)) / Math.exp(w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -9e+15: tmp = math.exp(-w) else: tmp = math.pow(l, (w + 1.0)) / math.exp(w) return tmp
function code(w, l) tmp = 0.0 if (w <= -9e+15) tmp = exp(Float64(-w)); else tmp = Float64((l ^ Float64(w + 1.0)) / exp(w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -9e+15) tmp = exp(-w); else tmp = (l ^ (w + 1.0)) / exp(w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -9e+15], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -9 \cdot 10^{+15}:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(w + 1\right)}}{e^{w}}\\
\end{array}
\end{array}
if w < -9e15Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -9e15 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in l around inf 92.5%
mul-1-neg92.5%
distribute-rgt-neg-in92.5%
log-rec92.5%
remove-double-neg92.5%
+-rgt-identity92.5%
exp-diff93.0%
+-rgt-identity93.0%
remove-double-neg93.0%
distribute-lft-neg-in93.0%
distribute-rgt-neg-out93.0%
Simplified93.0%
Taylor expanded in w around 0 92.6%
distribute-rgt1-in92.6%
Simplified92.6%
Taylor expanded in w around inf 92.6%
exp-diff92.0%
exp-to-pow98.6%
+-commutative98.6%
Simplified98.6%
Final simplification99.0%
(FPCore (w l) :precision binary64 (if (or (<= w -0.155) (not (<= w 1800000.0))) (exp (- w)) (+ l (* w (- (* l (log l)) l)))))
double code(double w, double l) {
double tmp;
if ((w <= -0.155) || !(w <= 1800000.0)) {
tmp = exp(-w);
} else {
tmp = l + (w * ((l * log(l)) - l));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if ((w <= (-0.155d0)) .or. (.not. (w <= 1800000.0d0))) then
tmp = exp(-w)
else
tmp = l + (w * ((l * log(l)) - l))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.155) || !(w <= 1800000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l + (w * ((l * Math.log(l)) - l));
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.155) or not (w <= 1800000.0): tmp = math.exp(-w) else: tmp = l + (w * ((l * math.log(l)) - l)) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.155) || !(w <= 1800000.0)) tmp = exp(Float64(-w)); else tmp = Float64(l + Float64(w * Float64(Float64(l * log(l)) - l))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.155) || ~((w <= 1800000.0))) tmp = exp(-w); else tmp = l + (w * ((l * log(l)) - l)); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.155], N[Not[LessEqual[w, 1800000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(l + N[(w * N[(N[(l * N[Log[l], $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.155 \lor \neg \left(w \leq 1800000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell + w \cdot \left(\ell \cdot \log \ell - \ell\right)\\
\end{array}
\end{array}
if w < -0.154999999999999999 or 1.8e6 < w Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.154999999999999999 < w < 1.8e6Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 96.9%
Final simplification98.2%
(FPCore (w l) :precision binary64 (if (or (<= w -0.26) (not (<= w 1800000.0))) (exp (- w)) (+ l (* (* l w) (+ (log l) -1.0)))))
double code(double w, double l) {
double tmp;
if ((w <= -0.26) || !(w <= 1800000.0)) {
tmp = exp(-w);
} else {
tmp = l + ((l * w) * (log(l) + -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.26d0)) .or. (.not. (w <= 1800000.0d0))) then
tmp = exp(-w)
else
tmp = l + ((l * w) * (log(l) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.26) || !(w <= 1800000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l + ((l * w) * (Math.log(l) + -1.0));
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.26) or not (w <= 1800000.0): tmp = math.exp(-w) else: tmp = l + ((l * w) * (math.log(l) + -1.0)) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.26) || !(w <= 1800000.0)) tmp = exp(Float64(-w)); else tmp = Float64(l + Float64(Float64(l * w) * Float64(log(l) + -1.0))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.26) || ~((w <= 1800000.0))) tmp = exp(-w); else tmp = l + ((l * w) * (log(l) + -1.0)); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.26], N[Not[LessEqual[w, 1800000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(l + N[(N[(l * w), $MachinePrecision] * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.26 \lor \neg \left(w \leq 1800000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell + \left(\ell \cdot w\right) \cdot \left(\log \ell + -1\right)\\
\end{array}
\end{array}
if w < -0.26000000000000001 or 1.8e6 < w Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.26000000000000001 < w < 1.8e6Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 96.9%
+-commutative96.9%
fma-define96.9%
sub-neg96.9%
*-commutative96.9%
neg-mul-196.9%
distribute-rgt-out96.9%
Simplified96.9%
fma-undefine96.9%
associate-*r*97.6%
Applied egg-rr97.6%
Final simplification98.6%
(FPCore (w l) :precision binary64 (if (or (<= w -0.68) (not (<= w 1800000.0))) (exp (- w)) l))
double code(double w, double l) {
double tmp;
if ((w <= -0.68) || !(w <= 1800000.0)) {
tmp = exp(-w);
} 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 ((w <= (-0.68d0)) .or. (.not. (w <= 1800000.0d0))) then
tmp = exp(-w)
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.68) || !(w <= 1800000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.68) or not (w <= 1800000.0): tmp = math.exp(-w) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.68) || !(w <= 1800000.0)) tmp = exp(Float64(-w)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.68) || ~((w <= 1800000.0))) tmp = exp(-w); else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.68], N[Not[LessEqual[w, 1800000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.68 \lor \neg \left(w \leq 1800000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.680000000000000049 or 1.8e6 < w Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.680000000000000049 < w < 1.8e6Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 96.7%
Final simplification98.1%
(FPCore (w l) :precision binary64 l)
double code(double w, double l) {
return l;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l
end function
public static double code(double w, double l) {
return l;
}
def code(w, l): return l
function code(w, l) return l end
function tmp = code(w, l) tmp = l; end
code[w_, l_] := l
\begin{array}{l}
\\
\ell
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
Taylor expanded in w around 0 57.1%
Final simplification57.1%
herbie shell --seed 2024075
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))