
(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 13 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 (- 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}
Initial program 99.3%
(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.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
(FPCore (w l) :precision binary64 (if (or (<= w -0.7) (not (<= w 20000.0))) (exp (- w)) (* l (exp w))))
double code(double w, double l) {
double tmp;
if ((w <= -0.7) || !(w <= 20000.0)) {
tmp = exp(-w);
} else {
tmp = l * 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 <= (-0.7d0)) .or. (.not. (w <= 20000.0d0))) then
tmp = exp(-w)
else
tmp = l * exp(w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.7) || !(w <= 20000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l * Math.exp(w);
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.7) or not (w <= 20000.0): tmp = math.exp(-w) else: tmp = l * math.exp(w) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.7) || !(w <= 20000.0)) tmp = exp(Float64(-w)); else tmp = Float64(l * exp(w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.7) || ~((w <= 20000.0))) tmp = exp(-w); else tmp = l * exp(w); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.7], N[Not[LessEqual[w, 20000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(l * N[Exp[w], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7 \lor \neg \left(w \leq 20000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot e^{w}\\
\end{array}
\end{array}
if w < -0.69999999999999996 or 2e4 < 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%
add-sqr-sqrt25.9%
sqrt-unprod63.4%
sqr-neg63.4%
sqrt-unprod37.5%
add-sqr-sqrt63.4%
add-sqr-sqrt63.4%
sqrt-unprod63.4%
add-sqr-sqrt37.5%
sqrt-unprod37.5%
sqr-neg37.5%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
pow10.1%
exp-neg0.1%
inv-pow0.1%
pow-prod-up99.2%
metadata-eval99.2%
metadata-eval99.2%
metadata-eval99.2%
Applied egg-rr99.2%
add-exp-log99.2%
*-rgt-identity99.2%
log-div99.2%
add-log-exp99.2%
Applied egg-rr99.2%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.69999999999999996 < w < 2e4Initial program 98.8%
exp-neg98.8%
remove-double-neg98.8%
associate-*l/98.8%
*-lft-identity98.8%
remove-double-neg98.8%
Simplified98.8%
add-sqr-sqrt46.9%
sqrt-unprod97.9%
sqr-neg97.9%
sqrt-unprod51.0%
add-sqr-sqrt95.5%
add-sqr-sqrt95.5%
sqrt-unprod95.5%
add-sqr-sqrt51.0%
sqrt-unprod95.5%
sqr-neg95.5%
sqrt-unprod44.6%
add-sqr-sqrt95.6%
pow195.6%
exp-neg95.6%
inv-pow95.6%
pow-prod-up95.6%
metadata-eval95.6%
metadata-eval95.6%
metadata-eval95.6%
Applied egg-rr95.6%
associate-/l*95.6%
*-commutative95.6%
rec-exp95.6%
Applied egg-rr95.6%
pow195.6%
*-commutative95.6%
add-sqr-sqrt51.0%
sqrt-unprod96.3%
sqr-neg96.3%
sqrt-unprod45.3%
add-sqr-sqrt96.3%
Applied egg-rr96.3%
unpow196.3%
Simplified96.3%
Final simplification97.9%
(FPCore (w l) :precision binary64 (if (or (<= w -0.72) (not (<= w 19000.0))) (exp (- w)) (- l (* (* w l) (+ (* w -0.5) -1.0)))))
double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 19000.0)) {
tmp = exp(-w);
} else {
tmp = l - ((w * l) * ((w * -0.5) + -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.72d0)) .or. (.not. (w <= 19000.0d0))) then
tmp = exp(-w)
else
tmp = l - ((w * l) * ((w * (-0.5d0)) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 19000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l - ((w * l) * ((w * -0.5) + -1.0));
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.72) or not (w <= 19000.0): tmp = math.exp(-w) else: tmp = l - ((w * l) * ((w * -0.5) + -1.0)) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.72) || !(w <= 19000.0)) tmp = exp(Float64(-w)); else tmp = Float64(l - Float64(Float64(w * l) * Float64(Float64(w * -0.5) + -1.0))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.72) || ~((w <= 19000.0))) tmp = exp(-w); else tmp = l - ((w * l) * ((w * -0.5) + -1.0)); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.72], N[Not[LessEqual[w, 19000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(l - N[(N[(w * l), $MachinePrecision] * N[(N[(w * -0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.72 \lor \neg \left(w \leq 19000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell - \left(w \cdot \ell\right) \cdot \left(w \cdot -0.5 + -1\right)\\
\end{array}
\end{array}
if w < -0.71999999999999997 or 19000 < 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%
add-sqr-sqrt25.9%
sqrt-unprod63.4%
sqr-neg63.4%
sqrt-unprod37.5%
add-sqr-sqrt63.4%
add-sqr-sqrt63.4%
sqrt-unprod63.4%
add-sqr-sqrt37.5%
sqrt-unprod37.5%
sqr-neg37.5%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
pow10.1%
exp-neg0.1%
inv-pow0.1%
pow-prod-up99.2%
metadata-eval99.2%
metadata-eval99.2%
metadata-eval99.2%
Applied egg-rr99.2%
add-exp-log99.2%
*-rgt-identity99.2%
log-div99.2%
add-log-exp99.2%
Applied egg-rr99.2%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.71999999999999997 < w < 19000Initial program 98.8%
exp-neg98.8%
remove-double-neg98.8%
associate-*l/98.8%
*-lft-identity98.8%
remove-double-neg98.8%
Simplified98.8%
add-sqr-sqrt46.9%
sqrt-unprod97.9%
sqr-neg97.9%
sqrt-unprod51.0%
add-sqr-sqrt95.5%
add-sqr-sqrt95.5%
sqrt-unprod95.5%
add-sqr-sqrt51.0%
sqrt-unprod95.5%
sqr-neg95.5%
sqrt-unprod44.6%
add-sqr-sqrt95.6%
pow195.6%
exp-neg95.6%
inv-pow95.6%
pow-prod-up95.6%
metadata-eval95.6%
metadata-eval95.6%
metadata-eval95.6%
Applied egg-rr95.6%
Taylor expanded in w around 0 95.6%
associate-*r*95.6%
neg-mul-195.6%
distribute-rgt-out95.6%
metadata-eval95.6%
Simplified95.6%
add-sqr-sqrt44.6%
sqrt-unprod95.6%
sqr-neg95.6%
sqrt-unprod51.0%
add-sqr-sqrt95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
associate-*l*95.6%
add-sqr-sqrt51.0%
sqrt-unprod95.6%
sqr-neg95.6%
sqrt-unprod44.6%
add-sqr-sqrt95.6%
Applied egg-rr95.6%
sub-neg95.6%
distribute-lft-out95.6%
associate-*r*95.6%
distribute-rgt-neg-out95.6%
neg-mul-195.6%
*-commutative95.6%
distribute-lft-out95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Final simplification97.5%
(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.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
add-sqr-sqrt37.7%
sqrt-unprod82.8%
sqr-neg82.8%
sqrt-unprod45.1%
add-sqr-sqrt81.5%
add-sqr-sqrt81.5%
sqrt-unprod81.5%
add-sqr-sqrt45.1%
sqrt-unprod70.2%
sqr-neg70.2%
sqrt-unprod25.1%
add-sqr-sqrt53.8%
pow153.8%
exp-neg53.8%
inv-pow53.8%
pow-prod-up97.2%
metadata-eval97.2%
metadata-eval97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Taylor expanded in l around 0 97.2%
(FPCore (w l) :precision binary64 (if (<= w 1.55e-30) (+ l (* l (* w (+ -1.0 (* w (+ 0.5 (* w -0.16666666666666666))))))) (* w (/ l w))))
double code(double w, double l) {
double tmp;
if (w <= 1.55e-30) {
tmp = l + (l * (w * (-1.0 + (w * (0.5 + (w * -0.16666666666666666))))));
} else {
tmp = w * (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.55d-30) then
tmp = l + (l * (w * ((-1.0d0) + (w * (0.5d0 + (w * (-0.16666666666666666d0)))))))
else
tmp = w * (l / w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.55e-30) {
tmp = l + (l * (w * (-1.0 + (w * (0.5 + (w * -0.16666666666666666))))));
} else {
tmp = w * (l / w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.55e-30: tmp = l + (l * (w * (-1.0 + (w * (0.5 + (w * -0.16666666666666666)))))) else: tmp = w * (l / w) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.55e-30) tmp = Float64(l + Float64(l * Float64(w * Float64(-1.0 + Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))))))); else tmp = Float64(w * Float64(l / w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.55e-30) tmp = l + (l * (w * (-1.0 + (w * (0.5 + (w * -0.16666666666666666)))))); else tmp = w * (l / w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.55e-30], N[(l + N[(l * N[(w * N[(-1.0 + N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w * N[(l / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.55 \cdot 10^{-30}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(-1 + w \cdot \left(0.5 + w \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w \cdot \frac{\ell}{w}\\
\end{array}
\end{array}
if w < 1.54999999999999995e-30Initial program 99.9%
exp-neg99.9%
remove-double-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
remove-double-neg99.9%
Simplified99.9%
add-sqr-sqrt27.9%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod52.7%
add-sqr-sqrt80.6%
add-sqr-sqrt80.6%
sqrt-unprod80.6%
add-sqr-sqrt52.7%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod27.9%
add-sqr-sqrt61.4%
pow161.4%
exp-neg61.4%
inv-pow61.4%
pow-prod-up98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
Applied egg-rr98.9%
associate-/l*98.9%
*-commutative98.9%
rec-exp98.9%
Applied egg-rr98.9%
Taylor expanded in w around 0 86.1%
Taylor expanded in l around 0 87.8%
if 1.54999999999999995e-30 < w Initial program 96.1%
exp-neg96.1%
remove-double-neg96.1%
associate-*l/96.1%
*-lft-identity96.1%
remove-double-neg96.1%
Simplified96.1%
add-sqr-sqrt96.1%
sqrt-unprod96.1%
sqr-neg96.1%
sqrt-unprod0.0%
add-sqr-sqrt86.9%
add-sqr-sqrt86.9%
sqrt-unprod86.9%
add-sqr-sqrt0.0%
sqrt-unprod8.7%
sqr-neg8.7%
sqrt-unprod8.7%
add-sqr-sqrt8.7%
pow18.7%
exp-neg8.7%
inv-pow8.7%
pow-prod-up87.1%
metadata-eval87.1%
metadata-eval87.1%
metadata-eval87.1%
Applied egg-rr87.1%
Taylor expanded in w around 0 11.3%
mul-1-neg11.3%
unsub-neg11.3%
*-rgt-identity11.3%
distribute-lft-out--11.3%
Simplified11.3%
Taylor expanded in w around inf 11.3%
neg-mul-111.3%
+-commutative11.3%
sub-neg11.3%
Simplified11.3%
Taylor expanded in w around 0 48.6%
Final simplification82.2%
(FPCore (w l) :precision binary64 (if (<= w 54000.0) (+ l (* l (* w (+ -1.0 (* w 0.5))))) (* w (/ l w))))
double code(double w, double l) {
double tmp;
if (w <= 54000.0) {
tmp = l + (l * (w * (-1.0 + (w * 0.5))));
} else {
tmp = w * (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 <= 54000.0d0) then
tmp = l + (l * (w * ((-1.0d0) + (w * 0.5d0))))
else
tmp = w * (l / w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 54000.0) {
tmp = l + (l * (w * (-1.0 + (w * 0.5))));
} else {
tmp = w * (l / w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 54000.0: tmp = l + (l * (w * (-1.0 + (w * 0.5)))) else: tmp = w * (l / w) return tmp
function code(w, l) tmp = 0.0 if (w <= 54000.0) tmp = Float64(l + Float64(l * Float64(w * Float64(-1.0 + Float64(w * 0.5))))); else tmp = Float64(w * Float64(l / w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 54000.0) tmp = l + (l * (w * (-1.0 + (w * 0.5)))); else tmp = w * (l / w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 54000.0], N[(l + N[(l * N[(w * N[(-1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w * N[(l / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 54000:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(-1 + w \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w \cdot \frac{\ell}{w}\\
\end{array}
\end{array}
if w < 54000Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
add-sqr-sqrt29.8%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod50.8%
add-sqr-sqrt79.1%
add-sqr-sqrt79.1%
sqrt-unprod79.1%
add-sqr-sqrt50.8%
sqrt-unprod79.1%
sqr-neg79.1%
sqrt-unprod28.3%
add-sqr-sqrt60.7%
pow160.7%
exp-neg60.7%
inv-pow60.7%
pow-prod-up96.8%
metadata-eval96.8%
metadata-eval96.8%
metadata-eval96.8%
Applied egg-rr96.8%
Taylor expanded in w around 0 80.7%
associate-*r*80.7%
neg-mul-180.7%
distribute-rgt-out80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in l around 0 82.8%
if 54000 < 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%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow10.0%
exp-neg0.0%
inv-pow0.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 3.5%
mul-1-neg3.5%
unsub-neg3.5%
*-rgt-identity3.5%
distribute-lft-out--3.5%
Simplified3.5%
Taylor expanded in w around inf 3.5%
neg-mul-13.5%
+-commutative3.5%
sub-neg3.5%
Simplified3.5%
Taylor expanded in w around 0 50.7%
Final simplification79.2%
(FPCore (w l) :precision binary64 (if (<= w 90000.0) (* l (+ 1.0 (* w (+ -1.0 (* w 0.5))))) (* w (/ l w))))
double code(double w, double l) {
double tmp;
if (w <= 90000.0) {
tmp = l * (1.0 + (w * (-1.0 + (w * 0.5))));
} else {
tmp = w * (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 <= 90000.0d0) then
tmp = l * (1.0d0 + (w * ((-1.0d0) + (w * 0.5d0))))
else
tmp = w * (l / w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 90000.0) {
tmp = l * (1.0 + (w * (-1.0 + (w * 0.5))));
} else {
tmp = w * (l / w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 90000.0: tmp = l * (1.0 + (w * (-1.0 + (w * 0.5)))) else: tmp = w * (l / w) return tmp
function code(w, l) tmp = 0.0 if (w <= 90000.0) tmp = Float64(l * Float64(1.0 + Float64(w * Float64(-1.0 + Float64(w * 0.5))))); else tmp = Float64(w * Float64(l / w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 90000.0) tmp = l * (1.0 + (w * (-1.0 + (w * 0.5)))); else tmp = w * (l / w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 90000.0], N[(l * N[(1.0 + N[(w * N[(-1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w * N[(l / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 90000:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(-1 + w \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w \cdot \frac{\ell}{w}\\
\end{array}
\end{array}
if w < 9e4Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
add-sqr-sqrt29.8%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod50.8%
add-sqr-sqrt79.1%
add-sqr-sqrt79.1%
sqrt-unprod79.1%
add-sqr-sqrt50.8%
sqrt-unprod79.1%
sqr-neg79.1%
sqrt-unprod28.3%
add-sqr-sqrt60.7%
pow160.7%
exp-neg60.7%
inv-pow60.7%
pow-prod-up96.8%
metadata-eval96.8%
metadata-eval96.8%
metadata-eval96.8%
Applied egg-rr96.8%
Taylor expanded in w around 0 80.7%
associate-*r*80.7%
neg-mul-180.7%
distribute-rgt-out80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in l around 0 82.8%
if 9e4 < 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%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow10.0%
exp-neg0.0%
inv-pow0.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 3.5%
mul-1-neg3.5%
unsub-neg3.5%
*-rgt-identity3.5%
distribute-lft-out--3.5%
Simplified3.5%
Taylor expanded in w around inf 3.5%
neg-mul-13.5%
+-commutative3.5%
sub-neg3.5%
Simplified3.5%
Taylor expanded in w around 0 50.7%
Final simplification79.2%
(FPCore (w l) :precision binary64 (if (<= w 240000.0) (+ l (* w (* l (* w 0.5)))) (* w (/ l w))))
double code(double w, double l) {
double tmp;
if (w <= 240000.0) {
tmp = l + (w * (l * (w * 0.5)));
} else {
tmp = w * (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 <= 240000.0d0) then
tmp = l + (w * (l * (w * 0.5d0)))
else
tmp = w * (l / w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 240000.0) {
tmp = l + (w * (l * (w * 0.5)));
} else {
tmp = w * (l / w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 240000.0: tmp = l + (w * (l * (w * 0.5))) else: tmp = w * (l / w) return tmp
function code(w, l) tmp = 0.0 if (w <= 240000.0) tmp = Float64(l + Float64(w * Float64(l * Float64(w * 0.5)))); else tmp = Float64(w * Float64(l / w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 240000.0) tmp = l + (w * (l * (w * 0.5))); else tmp = w * (l / w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 240000.0], N[(l + N[(w * N[(l * N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(w * N[(l / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 240000:\\
\;\;\;\;\ell + w \cdot \left(\ell \cdot \left(w \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;w \cdot \frac{\ell}{w}\\
\end{array}
\end{array}
if w < 2.4e5Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
add-sqr-sqrt29.8%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod50.8%
add-sqr-sqrt79.1%
add-sqr-sqrt79.1%
sqrt-unprod79.1%
add-sqr-sqrt50.8%
sqrt-unprod79.1%
sqr-neg79.1%
sqrt-unprod28.3%
add-sqr-sqrt60.7%
pow160.7%
exp-neg60.7%
inv-pow60.7%
pow-prod-up96.8%
metadata-eval96.8%
metadata-eval96.8%
metadata-eval96.8%
Applied egg-rr96.8%
Taylor expanded in w around 0 80.7%
associate-*r*80.7%
neg-mul-180.7%
distribute-rgt-out80.7%
metadata-eval80.7%
Simplified80.7%
Taylor expanded in w around inf 80.7%
associate-*r*80.7%
*-commutative80.7%
associate-*l*80.7%
*-commutative80.7%
Simplified80.7%
if 2.4e5 < 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%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
sqr-neg100.0%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
add-sqr-sqrt100.0%
sqrt-unprod100.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
pow10.0%
exp-neg0.0%
inv-pow0.0%
pow-prod-up100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 3.5%
mul-1-neg3.5%
unsub-neg3.5%
*-rgt-identity3.5%
distribute-lft-out--3.5%
Simplified3.5%
Taylor expanded in w around inf 3.5%
neg-mul-13.5%
+-commutative3.5%
sub-neg3.5%
Simplified3.5%
Taylor expanded in w around 0 50.7%
(FPCore (w l) :precision binary64 (if (<= w 1.55e-30) (* l (- 1.0 w)) (* w (/ l w))))
double code(double w, double l) {
double tmp;
if (w <= 1.55e-30) {
tmp = l * (1.0 - w);
} else {
tmp = w * (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.55d-30) then
tmp = l * (1.0d0 - w)
else
tmp = w * (l / w)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.55e-30) {
tmp = l * (1.0 - w);
} else {
tmp = w * (l / w);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.55e-30: tmp = l * (1.0 - w) else: tmp = w * (l / w) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.55e-30) tmp = Float64(l * Float64(1.0 - w)); else tmp = Float64(w * Float64(l / w)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.55e-30) tmp = l * (1.0 - w); else tmp = w * (l / w); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.55e-30], N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision], N[(w * N[(l / w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.55 \cdot 10^{-30}:\\
\;\;\;\;\ell \cdot \left(1 - w\right)\\
\mathbf{else}:\\
\;\;\;\;w \cdot \frac{\ell}{w}\\
\end{array}
\end{array}
if w < 1.54999999999999995e-30Initial program 99.9%
exp-neg99.9%
remove-double-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
remove-double-neg99.9%
Simplified99.9%
add-sqr-sqrt27.9%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod52.7%
add-sqr-sqrt80.6%
add-sqr-sqrt80.6%
sqrt-unprod80.6%
add-sqr-sqrt52.7%
sqrt-unprod80.6%
sqr-neg80.6%
sqrt-unprod27.9%
add-sqr-sqrt61.4%
pow161.4%
exp-neg61.4%
inv-pow61.4%
pow-prod-up98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in w around 0 71.9%
mul-1-neg71.9%
unsub-neg71.9%
*-rgt-identity71.9%
distribute-lft-out--71.9%
Simplified71.9%
if 1.54999999999999995e-30 < w Initial program 96.1%
exp-neg96.1%
remove-double-neg96.1%
associate-*l/96.1%
*-lft-identity96.1%
remove-double-neg96.1%
Simplified96.1%
add-sqr-sqrt96.1%
sqrt-unprod96.1%
sqr-neg96.1%
sqrt-unprod0.0%
add-sqr-sqrt86.9%
add-sqr-sqrt86.9%
sqrt-unprod86.9%
add-sqr-sqrt0.0%
sqrt-unprod8.7%
sqr-neg8.7%
sqrt-unprod8.7%
add-sqr-sqrt8.7%
pow18.7%
exp-neg8.7%
inv-pow8.7%
pow-prod-up87.1%
metadata-eval87.1%
metadata-eval87.1%
metadata-eval87.1%
Applied egg-rr87.1%
Taylor expanded in w around 0 11.3%
mul-1-neg11.3%
unsub-neg11.3%
*-rgt-identity11.3%
distribute-lft-out--11.3%
Simplified11.3%
Taylor expanded in w around inf 11.3%
neg-mul-111.3%
+-commutative11.3%
sub-neg11.3%
Simplified11.3%
Taylor expanded in w around 0 48.6%
(FPCore (w l) :precision binary64 (if (<= w -0.0125) (* w (- l)) l))
double code(double w, double l) {
double tmp;
if (w <= -0.0125) {
tmp = w * -l;
} 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.0125d0)) then
tmp = w * -l
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.0125) {
tmp = w * -l;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.0125: tmp = w * -l else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -0.0125) tmp = Float64(w * Float64(-l)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.0125) tmp = w * -l; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.0125], N[(w * (-l)), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.0125:\\
\;\;\;\;w \cdot \left(-\ell\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.012500000000000001Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-sqr-sqrt0.0%
sqrt-unprod50.6%
sqr-neg50.6%
sqrt-unprod50.6%
add-sqr-sqrt50.6%
add-sqr-sqrt50.6%
sqrt-unprod50.6%
add-sqr-sqrt50.6%
sqrt-unprod50.6%
sqr-neg50.6%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
pow10.1%
exp-neg0.1%
inv-pow0.1%
pow-prod-up98.9%
metadata-eval98.9%
metadata-eval98.9%
metadata-eval98.9%
Applied egg-rr98.9%
Taylor expanded in w around 0 27.8%
mul-1-neg27.8%
unsub-neg27.8%
*-rgt-identity27.8%
distribute-lft-out--27.8%
Simplified27.8%
Taylor expanded in w around inf 27.8%
mul-1-neg27.8%
distribute-lft-neg-out27.8%
*-commutative27.8%
Simplified27.8%
if -0.012500000000000001 < w Initial program 99.0%
Taylor expanded in w around 0 80.5%
(FPCore (w l) :precision binary64 (* l (- 1.0 w)))
double code(double w, double l) {
return l * (1.0 - w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l * (1.0d0 - w)
end function
public static double code(double w, double l) {
return l * (1.0 - w);
}
def code(w, l): return l * (1.0 - w)
function code(w, l) return Float64(l * Float64(1.0 - w)) end
function tmp = code(w, l) tmp = l * (1.0 - w); end
code[w_, l_] := N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell \cdot \left(1 - w\right)
\end{array}
Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
add-sqr-sqrt37.7%
sqrt-unprod82.8%
sqr-neg82.8%
sqrt-unprod45.1%
add-sqr-sqrt81.5%
add-sqr-sqrt81.5%
sqrt-unprod81.5%
add-sqr-sqrt45.1%
sqrt-unprod70.2%
sqr-neg70.2%
sqrt-unprod25.1%
add-sqr-sqrt53.8%
pow153.8%
exp-neg53.8%
inv-pow53.8%
pow-prod-up97.2%
metadata-eval97.2%
metadata-eval97.2%
metadata-eval97.2%
Applied egg-rr97.2%
Taylor expanded in w around 0 63.1%
mul-1-neg63.1%
unsub-neg63.1%
*-rgt-identity63.1%
distribute-lft-out--63.1%
Simplified63.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.3%
Taylor expanded in w around 0 55.6%
herbie shell --seed 2024108
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))