
(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))) (t_1 (cbrt (exp w))))
(if (<= (* t_0 (exp (- w))) 1e+305)
(/ (/ t_0 t_1) (pow t_1 2.0))
(exp (- (* (exp w) (log l)) w)))))
double code(double w, double l) {
double t_0 = pow(l, exp(w));
double t_1 = cbrt(exp(w));
double tmp;
if ((t_0 * exp(-w)) <= 1e+305) {
tmp = (t_0 / t_1) / pow(t_1, 2.0);
} else {
tmp = exp(((exp(w) * log(l)) - w));
}
return tmp;
}
public static double code(double w, double l) {
double t_0 = Math.pow(l, Math.exp(w));
double t_1 = Math.cbrt(Math.exp(w));
double tmp;
if ((t_0 * Math.exp(-w)) <= 1e+305) {
tmp = (t_0 / t_1) / Math.pow(t_1, 2.0);
} else {
tmp = Math.exp(((Math.exp(w) * Math.log(l)) - w));
}
return tmp;
}
function code(w, l) t_0 = l ^ exp(w) t_1 = cbrt(exp(w)) tmp = 0.0 if (Float64(t_0 * exp(Float64(-w))) <= 1e+305) tmp = Float64(Float64(t_0 / t_1) / (t_1 ^ 2.0)); else tmp = exp(Float64(Float64(exp(w) * log(l)) - w)); end return tmp end
code[w_, l_] := Block[{t$95$0 = N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-w)], $MachinePrecision]), $MachinePrecision], 1e+305], N[(N[(t$95$0 / t$95$1), $MachinePrecision] / N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Exp[w], $MachinePrecision] * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{\left(e^{w}\right)}\\
t_1 := \sqrt[3]{e^{w}}\\
\mathbf{if}\;t_0 \cdot e^{-w} \leq 10^{+305}:\\
\;\;\;\;\frac{\frac{t_0}{t_1}}{{t_1}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{e^{w} \cdot \log \ell - w}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 9.9999999999999994e304Initial program 99.7%
exp-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
*-un-lft-identity99.7%
add-cube-cbrt99.7%
times-frac99.7%
cbrt-unprod99.7%
prod-exp99.7%
Applied egg-rr99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
exp-sum99.7%
cbrt-prod99.7%
pow299.7%
Applied egg-rr99.7%
if 9.9999999999999994e304 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 93.2%
exp-neg93.2%
associate-*l/93.2%
*-lft-identity93.2%
Simplified93.2%
add-exp-log93.2%
log-div93.2%
log-pow93.2%
add-log-exp100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (w l) :precision binary64 (let* ((t_0 (cbrt (exp w)))) (/ (/ (pow l (exp w)) t_0) (pow (+ (exp (log1p t_0)) -1.0) 2.0))))
double code(double w, double l) {
double t_0 = cbrt(exp(w));
return (pow(l, exp(w)) / t_0) / pow((exp(log1p(t_0)) + -1.0), 2.0);
}
public static double code(double w, double l) {
double t_0 = Math.cbrt(Math.exp(w));
return (Math.pow(l, Math.exp(w)) / t_0) / Math.pow((Math.exp(Math.log1p(t_0)) + -1.0), 2.0);
}
function code(w, l) t_0 = cbrt(exp(w)) return Float64(Float64((l ^ exp(w)) / t_0) / (Float64(exp(log1p(t_0)) + -1.0) ^ 2.0)) end
code[w_, l_] := Block[{t$95$0 = N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] / N[Power[N[(N[Exp[N[Log[1 + t$95$0], $MachinePrecision]], $MachinePrecision] + -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{e^{w}}\\
\frac{\frac{{\ell}^{\left(e^{w}\right)}}{t_0}}{{\left(e^{\mathsf{log1p}\left(t_0\right)} + -1\right)}^{2}}
\end{array}
\end{array}
Initial program 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
*-un-lft-identity98.2%
add-cube-cbrt98.2%
times-frac98.2%
cbrt-unprod98.2%
prod-exp98.2%
Applied egg-rr98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
exp-sum98.2%
cbrt-prod98.2%
pow298.2%
Applied egg-rr98.2%
expm1-log1p-u98.2%
expm1-udef98.2%
Applied egg-rr98.2%
Final simplification98.2%
(FPCore (w l)
:precision binary64
(let* ((t_0 (pow l (exp w))))
(if (<= (* t_0 (exp (- w))) 1e+305)
(/ t_0 (exp w))
(exp (- (* (exp w) (log l)) w)))))
double code(double w, double l) {
double t_0 = pow(l, exp(w));
double tmp;
if ((t_0 * exp(-w)) <= 1e+305) {
tmp = t_0 / exp(w);
} else {
tmp = exp(((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) :: t_0
real(8) :: tmp
t_0 = l ** exp(w)
if ((t_0 * exp(-w)) <= 1d+305) then
tmp = t_0 / exp(w)
else
tmp = exp(((exp(w) * log(l)) - w))
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = Math.pow(l, Math.exp(w));
double tmp;
if ((t_0 * Math.exp(-w)) <= 1e+305) {
tmp = t_0 / Math.exp(w);
} else {
tmp = Math.exp(((Math.exp(w) * Math.log(l)) - w));
}
return tmp;
}
def code(w, l): t_0 = math.pow(l, math.exp(w)) tmp = 0 if (t_0 * math.exp(-w)) <= 1e+305: tmp = t_0 / math.exp(w) else: tmp = math.exp(((math.exp(w) * math.log(l)) - w)) return tmp
function code(w, l) t_0 = l ^ exp(w) tmp = 0.0 if (Float64(t_0 * exp(Float64(-w))) <= 1e+305) tmp = Float64(t_0 / exp(w)); else tmp = exp(Float64(Float64(exp(w) * log(l)) - w)); end return tmp end
function tmp_2 = code(w, l) t_0 = l ^ exp(w); tmp = 0.0; if ((t_0 * exp(-w)) <= 1e+305) tmp = t_0 / exp(w); else tmp = exp(((exp(w) * log(l)) - w)); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Exp[(-w)], $MachinePrecision]), $MachinePrecision], 1e+305], N[(t$95$0 / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Exp[w], $MachinePrecision] * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\ell}^{\left(e^{w}\right)}\\
\mathbf{if}\;t_0 \cdot e^{-w} \leq 10^{+305}:\\
\;\;\;\;\frac{t_0}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;e^{e^{w} \cdot \log \ell - w}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 9.9999999999999994e304Initial program 99.7%
exp-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
if 9.9999999999999994e304 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 93.2%
exp-neg93.2%
associate-*l/93.2%
*-lft-identity93.2%
Simplified93.2%
add-exp-log93.2%
log-div93.2%
log-pow93.2%
add-log-exp100.0%
Applied egg-rr100.0%
Final simplification99.8%
(FPCore (w l) :precision binary64 (/ (/ (pow l (exp w)) (cbrt (exp w))) (cbrt (exp (+ w w)))))
double code(double w, double l) {
return (pow(l, exp(w)) / cbrt(exp(w))) / cbrt(exp((w + w)));
}
public static double code(double w, double l) {
return (Math.pow(l, Math.exp(w)) / Math.cbrt(Math.exp(w))) / Math.cbrt(Math.exp((w + w)));
}
function code(w, l) return Float64(Float64((l ^ exp(w)) / cbrt(exp(w))) / cbrt(exp(Float64(w + w)))) end
code[w_, l_] := N[(N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] / N[Power[N[Exp[N[(w + w), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{\ell}^{\left(e^{w}\right)}}{\sqrt[3]{e^{w}}}}{\sqrt[3]{e^{w + w}}}
\end{array}
Initial program 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
*-un-lft-identity98.2%
add-cube-cbrt98.2%
times-frac98.2%
cbrt-unprod98.2%
prod-exp98.2%
Applied egg-rr98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (w l) :precision binary64 (/ (/ (pow l (exp w)) (sqrt (exp w))) (exp (* w 0.5))))
double code(double w, double l) {
return (pow(l, exp(w)) / sqrt(exp(w))) / exp((w * 0.5));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = ((l ** exp(w)) / sqrt(exp(w))) / exp((w * 0.5d0))
end function
public static double code(double w, double l) {
return (Math.pow(l, Math.exp(w)) / Math.sqrt(Math.exp(w))) / Math.exp((w * 0.5));
}
def code(w, l): return (math.pow(l, math.exp(w)) / math.sqrt(math.exp(w))) / math.exp((w * 0.5))
function code(w, l) return Float64(Float64((l ^ exp(w)) / sqrt(exp(w))) / exp(Float64(w * 0.5))) end
function tmp = code(w, l) tmp = ((l ^ exp(w)) / sqrt(exp(w))) / exp((w * 0.5)); end
code[w_, l_] := N[(N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Exp[N[(w * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{\ell}^{\left(e^{w}\right)}}{\sqrt{e^{w}}}}{e^{w \cdot 0.5}}
\end{array}
Initial program 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
*-un-lft-identity98.2%
add-sqr-sqrt98.2%
times-frac98.2%
Applied egg-rr98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
pow1/298.2%
pow-exp98.2%
Applied egg-rr98.2%
Final simplification98.2%
(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 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
Final simplification98.2%
(FPCore (w l)
:precision binary64
(if (<= w -1.3)
(exp (- (log l) w))
(if (<= w 1.25e-8)
(/ (* l (pow l w)) (exp w))
(exp (- (* (log l) (+ (+ w 1.0) (* 0.5 (* w w)))) w)))))
double code(double w, double l) {
double tmp;
if (w <= -1.3) {
tmp = exp((log(l) - w));
} else if (w <= 1.25e-8) {
tmp = (l * pow(l, w)) / exp(w);
} else {
tmp = exp(((log(l) * ((w + 1.0) + (0.5 * (w * w)))) - w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-1.3d0)) then
tmp = exp((log(l) - w))
else if (w <= 1.25d-8) then
tmp = (l * (l ** w)) / exp(w)
else
tmp = exp(((log(l) * ((w + 1.0d0) + (0.5d0 * (w * w)))) - w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.3) {
tmp = Math.exp((Math.log(l) - w));
} else if (w <= 1.25e-8) {
tmp = (l * Math.pow(l, w)) / Math.exp(w);
} else {
tmp = Math.exp(((Math.log(l) * ((w + 1.0) + (0.5 * (w * w)))) - w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.3: tmp = math.exp((math.log(l) - w)) elif w <= 1.25e-8: tmp = (l * math.pow(l, w)) / math.exp(w) else: tmp = math.exp(((math.log(l) * ((w + 1.0) + (0.5 * (w * w)))) - w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.3) tmp = exp(Float64(log(l) - w)); elseif (w <= 1.25e-8) tmp = Float64(Float64(l * (l ^ w)) / exp(w)); else tmp = exp(Float64(Float64(log(l) * Float64(Float64(w + 1.0) + Float64(0.5 * Float64(w * w)))) - w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.3) tmp = exp((log(l) - w)); elseif (w <= 1.25e-8) tmp = (l * (l ^ w)) / exp(w); else tmp = exp(((log(l) * ((w + 1.0) + (0.5 * (w * w)))) - w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.3], N[Exp[N[(N[Log[l], $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], If[LessEqual[w, 1.25e-8], N[(N[(l * N[Power[l, w], $MachinePrecision]), $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Log[l], $MachinePrecision] * N[(N[(w + 1.0), $MachinePrecision] + N[(0.5 * N[(w * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.3:\\
\;\;\;\;e^{\log \ell - w}\\
\mathbf{elif}\;w \leq 1.25 \cdot 10^{-8}:\\
\;\;\;\;\frac{\ell \cdot {\ell}^{w}}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \ell \cdot \left(\left(w + 1\right) + 0.5 \cdot \left(w \cdot w\right)\right) - w}\\
\end{array}
\end{array}
if w < -1.30000000000000004Initial program 99.9%
exp-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
add-exp-log99.9%
log-div99.9%
log-pow99.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in w around 0 98.3%
if -1.30000000000000004 < w < 1.2499999999999999e-8Initial program 99.7%
exp-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
add-exp-log91.2%
log-div91.2%
log-pow91.3%
add-log-exp91.3%
Applied egg-rr91.3%
Taylor expanded in w around 0 90.4%
distribute-lft1-in90.4%
Simplified90.4%
Taylor expanded in w around inf 90.4%
exp-diff90.4%
*-commutative90.4%
exp-to-pow98.7%
+-commutative98.7%
Simplified98.7%
pow-plus99.0%
Applied egg-rr99.0%
if 1.2499999999999999e-8 < w Initial program 90.8%
exp-neg90.8%
associate-*l/90.8%
*-lft-identity90.8%
Simplified90.8%
add-exp-log90.7%
log-div90.7%
log-pow90.7%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in w around 0 99.7%
+-commutative99.7%
distribute-lft1-in99.8%
associate-*r*99.8%
distribute-rgt-out99.8%
unpow299.8%
Simplified99.8%
Final simplification99.0%
(FPCore (w l)
:precision binary64
(if (<= w -1.3)
(exp (- (log l) w))
(if (<= w 1.7e-7)
(/ (* l (pow l w)) (exp w))
(exp (- (* (log l) (+ w 1.0)) w)))))
double code(double w, double l) {
double tmp;
if (w <= -1.3) {
tmp = exp((log(l) - w));
} else if (w <= 1.7e-7) {
tmp = (l * pow(l, w)) / exp(w);
} else {
tmp = exp(((log(l) * (w + 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 (w <= (-1.3d0)) then
tmp = exp((log(l) - w))
else if (w <= 1.7d-7) then
tmp = (l * (l ** w)) / exp(w)
else
tmp = exp(((log(l) * (w + 1.0d0)) - w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.3) {
tmp = Math.exp((Math.log(l) - w));
} else if (w <= 1.7e-7) {
tmp = (l * Math.pow(l, w)) / Math.exp(w);
} else {
tmp = Math.exp(((Math.log(l) * (w + 1.0)) - w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.3: tmp = math.exp((math.log(l) - w)) elif w <= 1.7e-7: tmp = (l * math.pow(l, w)) / math.exp(w) else: tmp = math.exp(((math.log(l) * (w + 1.0)) - w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.3) tmp = exp(Float64(log(l) - w)); elseif (w <= 1.7e-7) tmp = Float64(Float64(l * (l ^ w)) / exp(w)); else tmp = exp(Float64(Float64(log(l) * Float64(w + 1.0)) - w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.3) tmp = exp((log(l) - w)); elseif (w <= 1.7e-7) tmp = (l * (l ^ w)) / exp(w); else tmp = exp(((log(l) * (w + 1.0)) - w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.3], N[Exp[N[(N[Log[l], $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], If[LessEqual[w, 1.7e-7], N[(N[(l * N[Power[l, w], $MachinePrecision]), $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Log[l], $MachinePrecision] * N[(w + 1.0), $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.3:\\
\;\;\;\;e^{\log \ell - w}\\
\mathbf{elif}\;w \leq 1.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{\ell \cdot {\ell}^{w}}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;e^{\log \ell \cdot \left(w + 1\right) - w}\\
\end{array}
\end{array}
if w < -1.30000000000000004Initial program 99.9%
exp-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
add-exp-log99.9%
log-div99.9%
log-pow99.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in w around 0 98.3%
if -1.30000000000000004 < w < 1.69999999999999987e-7Initial program 99.7%
exp-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
Simplified99.7%
add-exp-log91.2%
log-div91.2%
log-pow91.3%
add-log-exp91.3%
Applied egg-rr91.3%
Taylor expanded in w around 0 90.4%
distribute-lft1-in90.4%
Simplified90.4%
Taylor expanded in w around inf 90.4%
exp-diff90.4%
*-commutative90.4%
exp-to-pow98.7%
+-commutative98.7%
Simplified98.7%
pow-plus99.0%
Applied egg-rr99.0%
if 1.69999999999999987e-7 < w Initial program 90.8%
exp-neg90.8%
associate-*l/90.8%
*-lft-identity90.8%
Simplified90.8%
add-exp-log90.7%
log-div90.7%
log-pow90.7%
add-log-exp99.8%
Applied egg-rr99.8%
Taylor expanded in w around 0 99.1%
distribute-lft1-in99.1%
Simplified99.1%
Final simplification98.9%
(FPCore (w l) :precision binary64 (if (<= w -1.42) (exp (- (log l) w)) (if (<= w 10.0) (/ (* l (pow l w)) (exp w)) (exp (- (* w (log l)) w)))))
double code(double w, double l) {
double tmp;
if (w <= -1.42) {
tmp = exp((log(l) - w));
} else if (w <= 10.0) {
tmp = (l * pow(l, w)) / exp(w);
} 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 <= (-1.42d0)) then
tmp = exp((log(l) - w))
else if (w <= 10.0d0) then
tmp = (l * (l ** w)) / exp(w)
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 <= -1.42) {
tmp = Math.exp((Math.log(l) - w));
} else if (w <= 10.0) {
tmp = (l * Math.pow(l, w)) / Math.exp(w);
} else {
tmp = Math.exp(((w * Math.log(l)) - w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.42: tmp = math.exp((math.log(l) - w)) elif w <= 10.0: tmp = (l * math.pow(l, w)) / math.exp(w) else: tmp = math.exp(((w * math.log(l)) - w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.42) tmp = exp(Float64(log(l) - w)); elseif (w <= 10.0) tmp = Float64(Float64(l * (l ^ w)) / exp(w)); else tmp = exp(Float64(Float64(w * log(l)) - w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.42) tmp = exp((log(l) - w)); elseif (w <= 10.0) tmp = (l * (l ^ w)) / exp(w); else tmp = exp(((w * log(l)) - w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.42], N[Exp[N[(N[Log[l], $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], If[LessEqual[w, 10.0], N[(N[(l * N[Power[l, w], $MachinePrecision]), $MachinePrecision] / N[Exp[w], $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 -1.42:\\
\;\;\;\;e^{\log \ell - w}\\
\mathbf{elif}\;w \leq 10:\\
\;\;\;\;\frac{\ell \cdot {\ell}^{w}}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;e^{w \cdot \log \ell - w}\\
\end{array}
\end{array}
if w < -1.4199999999999999Initial program 99.9%
exp-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
add-exp-log99.9%
log-div99.9%
log-pow99.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in w around 0 98.3%
if -1.4199999999999999 < w < 10Initial program 99.6%
exp-neg99.6%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
add-exp-log91.2%
log-div91.2%
log-pow91.2%
add-log-exp91.2%
Applied egg-rr91.2%
Taylor expanded in w around 0 90.2%
distribute-lft1-in90.2%
Simplified90.2%
Taylor expanded in w around inf 90.2%
exp-diff90.2%
*-commutative90.2%
exp-to-pow98.5%
+-commutative98.5%
Simplified98.5%
pow-plus98.8%
Applied egg-rr98.8%
if 10 < w Initial program 90.7%
exp-neg90.7%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
add-exp-log90.7%
log-div90.7%
log-pow90.7%
add-log-exp100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 100.0%
distribute-lft1-in100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
Final simplification98.9%
(FPCore (w l)
:precision binary64
(let* ((t_0 (- (* w (log l)) w)))
(if (<= w -0.005)
(exp (- (log l) w))
(if (<= w 0.98) (+ l (* l t_0)) (exp t_0)))))
double code(double w, double l) {
double t_0 = (w * log(l)) - w;
double tmp;
if (w <= -0.005) {
tmp = exp((log(l) - w));
} else if (w <= 0.98) {
tmp = l + (l * t_0);
} else {
tmp = exp(t_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 = (w * log(l)) - w
if (w <= (-0.005d0)) then
tmp = exp((log(l) - w))
else if (w <= 0.98d0) then
tmp = l + (l * t_0)
else
tmp = exp(t_0)
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = (w * Math.log(l)) - w;
double tmp;
if (w <= -0.005) {
tmp = Math.exp((Math.log(l) - w));
} else if (w <= 0.98) {
tmp = l + (l * t_0);
} else {
tmp = Math.exp(t_0);
}
return tmp;
}
def code(w, l): t_0 = (w * math.log(l)) - w tmp = 0 if w <= -0.005: tmp = math.exp((math.log(l) - w)) elif w <= 0.98: tmp = l + (l * t_0) else: tmp = math.exp(t_0) return tmp
function code(w, l) t_0 = Float64(Float64(w * log(l)) - w) tmp = 0.0 if (w <= -0.005) tmp = exp(Float64(log(l) - w)); elseif (w <= 0.98) tmp = Float64(l + Float64(l * t_0)); else tmp = exp(t_0); end return tmp end
function tmp_2 = code(w, l) t_0 = (w * log(l)) - w; tmp = 0.0; if (w <= -0.005) tmp = exp((log(l) - w)); elseif (w <= 0.98) tmp = l + (l * t_0); else tmp = exp(t_0); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[(N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]}, If[LessEqual[w, -0.005], N[Exp[N[(N[Log[l], $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], If[LessEqual[w, 0.98], N[(l + N[(l * t$95$0), $MachinePrecision]), $MachinePrecision], N[Exp[t$95$0], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \log \ell - w\\
\mathbf{if}\;w \leq -0.005:\\
\;\;\;\;e^{\log \ell - w}\\
\mathbf{elif}\;w \leq 0.98:\\
\;\;\;\;\ell + \ell \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;e^{t_0}\\
\end{array}
\end{array}
if w < -0.0050000000000000001Initial program 99.9%
exp-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
Simplified99.9%
add-exp-log99.9%
log-div99.9%
log-pow99.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in w around 0 96.8%
if -0.0050000000000000001 < w < 0.97999999999999998Initial program 99.6%
exp-neg99.6%
associate-*l/99.6%
*-lft-identity99.6%
Simplified99.6%
Taylor expanded in w around 0 99.2%
sub-neg99.2%
distribute-rgt-in99.2%
Applied egg-rr99.2%
Taylor expanded in l around 0 99.2%
*-commutative99.2%
*-commutative99.2%
neg-mul-199.2%
sub-neg99.2%
Simplified99.2%
if 0.97999999999999998 < w Initial program 90.7%
exp-neg90.7%
associate-*l/90.7%
*-lft-identity90.7%
Simplified90.7%
add-exp-log90.7%
log-div90.7%
log-pow90.7%
add-log-exp100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 100.0%
distribute-lft1-in100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
*-commutative100.0%
sub-neg100.0%
metadata-eval100.0%
distribute-rgt-in100.0%
neg-mul-1100.0%
sub-neg100.0%
Simplified100.0%
Final simplification98.8%
(FPCore (w l) :precision binary64 (if (or (<= w -0.00295) (not (<= w 1450.0))) (exp (- (log l) w)) (+ l (* l (- (* w (log l)) w)))))
double code(double w, double l) {
double tmp;
if ((w <= -0.00295) || !(w <= 1450.0)) {
tmp = exp((log(l) - w));
} else {
tmp = l + (l * ((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.00295d0)) .or. (.not. (w <= 1450.0d0))) then
tmp = exp((log(l) - w))
else
tmp = l + (l * ((w * log(l)) - w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.00295) || !(w <= 1450.0)) {
tmp = Math.exp((Math.log(l) - w));
} else {
tmp = l + (l * ((w * Math.log(l)) - w));
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.00295) or not (w <= 1450.0): tmp = math.exp((math.log(l) - w)) else: tmp = l + (l * ((w * math.log(l)) - w)) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.00295) || !(w <= 1450.0)) tmp = exp(Float64(log(l) - w)); else tmp = Float64(l + Float64(l * Float64(Float64(w * log(l)) - w))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.00295) || ~((w <= 1450.0))) tmp = exp((log(l) - w)); else tmp = l + (l * ((w * log(l)) - w)); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.00295], N[Not[LessEqual[w, 1450.0]], $MachinePrecision]], N[Exp[N[(N[Log[l], $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], N[(l + N[(l * N[(N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.00295 \lor \neg \left(w \leq 1450\right):\\
\;\;\;\;e^{\log \ell - w}\\
\mathbf{else}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \log \ell - w\right)\\
\end{array}
\end{array}
if w < -0.00294999999999999993 or 1450 < w Initial program 97.9%
exp-neg97.9%
associate-*l/97.9%
*-lft-identity97.9%
Simplified97.9%
add-exp-log97.9%
log-div97.9%
log-pow97.9%
add-log-exp99.9%
Applied egg-rr99.9%
Taylor expanded in w around 0 96.1%
if -0.00294999999999999993 < w < 1450Initial program 98.4%
exp-neg98.4%
associate-*l/98.4%
*-lft-identity98.4%
Simplified98.4%
Taylor expanded in w around 0 98.6%
sub-neg98.6%
distribute-rgt-in98.0%
Applied egg-rr98.0%
Taylor expanded in l around 0 98.6%
*-commutative98.6%
*-commutative98.6%
neg-mul-198.6%
sub-neg98.6%
Simplified98.6%
Final simplification97.7%
(FPCore (w l) :precision binary64 (- l (+ (* l (* w (log l))) (* l w))))
double code(double w, double l) {
return l - ((l * (w * log(l))) + (l * w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l - ((l * (w * log(l))) + (l * w))
end function
public static double code(double w, double l) {
return l - ((l * (w * Math.log(l))) + (l * w));
}
def code(w, l): return l - ((l * (w * math.log(l))) + (l * w))
function code(w, l) return Float64(l - Float64(Float64(l * Float64(w * log(l))) + Float64(l * w))) end
function tmp = code(w, l) tmp = l - ((l * (w * log(l))) + (l * w)); end
code[w_, l_] := N[(l - N[(N[(l * N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(l * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell - \left(\ell \cdot \left(w \cdot \log \ell\right) + \ell \cdot w\right)
\end{array}
Initial program 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
Taylor expanded in w around 0 61.8%
sub-neg61.8%
distribute-rgt-in61.4%
Applied egg-rr61.4%
Taylor expanded in l around inf 61.4%
add-sqr-sqrt41.3%
sqrt-unprod58.3%
sqr-neg58.3%
mul-1-neg58.3%
mul-1-neg58.3%
sqrt-unprod33.0%
add-sqr-sqrt64.9%
expm1-log1p-u50.6%
expm1-udef50.8%
Applied egg-rr50.8%
expm1-def50.6%
expm1-log1p64.9%
*-commutative64.9%
*-commutative64.9%
associate-*r*64.9%
Simplified64.9%
Final simplification64.9%
(FPCore (w l) :precision binary64 (+ l (* l (- (* w (log l)) w))))
double code(double w, double l) {
return l + (l * ((w * log(l)) - w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l + (l * ((w * log(l)) - w))
end function
public static double code(double w, double l) {
return l + (l * ((w * Math.log(l)) - w));
}
def code(w, l): return l + (l * ((w * math.log(l)) - w))
function code(w, l) return Float64(l + Float64(l * Float64(Float64(w * log(l)) - w))) end
function tmp = code(w, l) tmp = l + (l * ((w * log(l)) - w)); end
code[w_, l_] := N[(l + N[(l * N[(N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell + \ell \cdot \left(w \cdot \log \ell - w\right)
\end{array}
Initial program 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
Taylor expanded in w around 0 61.8%
sub-neg61.8%
distribute-rgt-in61.4%
Applied egg-rr61.4%
Taylor expanded in l around 0 61.8%
*-commutative61.8%
*-commutative61.8%
neg-mul-161.8%
sub-neg61.8%
Simplified61.8%
Final simplification61.8%
(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 98.2%
exp-neg98.2%
associate-*l/98.2%
*-lft-identity98.2%
Simplified98.2%
Taylor expanded in w around 0 61.8%
Final simplification61.8%
herbie shell --seed 2023279
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))