
(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 11 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 (cbrt (exp w)))) (/ (/ (pow l (exp w)) (pow t_0 2.0)) t_0)))
double code(double w, double l) {
double t_0 = cbrt(exp(w));
return (pow(l, exp(w)) / pow(t_0, 2.0)) / t_0;
}
public static double code(double w, double l) {
double t_0 = Math.cbrt(Math.exp(w));
return (Math.pow(l, Math.exp(w)) / Math.pow(t_0, 2.0)) / t_0;
}
function code(w, l) t_0 = cbrt(exp(w)) return Float64(Float64((l ^ exp(w)) / (t_0 ^ 2.0)) / t_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] / N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{e^{w}}\\
\frac{\frac{{\ell}^{\left(e^{w}\right)}}{{t_0}^{2}}}{t_0}
\end{array}
\end{array}
Initial program 98.9%
*-commutative98.9%
exp-neg98.9%
div-inv98.9%
add-cube-cbrt98.9%
associate-/r*98.9%
pow298.9%
Applied egg-rr98.9%
Final simplification98.9%
(FPCore (w l) :precision binary64 (/ (* (pow l (exp w)) (cbrt (exp (- (- w) w)))) (cbrt (exp w))))
double code(double w, double l) {
return (pow(l, exp(w)) * cbrt(exp((-w - w)))) / cbrt(exp(w));
}
public static double code(double w, double l) {
return (Math.pow(l, Math.exp(w)) * Math.cbrt(Math.exp((-w - w)))) / Math.cbrt(Math.exp(w));
}
function code(w, l) return Float64(Float64((l ^ exp(w)) * cbrt(exp(Float64(Float64(-w) - w)))) / cbrt(exp(w))) end
code[w_, l_] := N[(N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] * N[Power[N[Exp[N[((-w) - w), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision] / N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{\left(e^{w}\right)} \cdot \sqrt[3]{e^{\left(-w\right) - w}}}{\sqrt[3]{e^{w}}}
\end{array}
Initial program 98.9%
*-commutative98.9%
exp-neg98.9%
div-inv98.9%
add-cube-cbrt98.9%
associate-/r*98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in l around 0 98.9%
unpow1/398.9%
unpow298.9%
prod-exp98.9%
rec-exp98.9%
Simplified98.9%
Final simplification98.9%
(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.9%
exp-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
Simplified98.9%
Final simplification98.9%
(FPCore (w l)
:precision binary64
(if (<= w -6.5e+88)
(+
l
(fma 0.05555555555555555 (* l (* w w)) (* l (* w -0.3333333333333333))))
(if (or (<= w -1200000.0) (not (<= w 0.07)))
(log (exp l))
(* l (+ 1.0 (* w (+ (log l) -1.0)))))))
double code(double w, double l) {
double tmp;
if (w <= -6.5e+88) {
tmp = l + fma(0.05555555555555555, (l * (w * w)), (l * (w * -0.3333333333333333)));
} else if ((w <= -1200000.0) || !(w <= 0.07)) {
tmp = log(exp(l));
} else {
tmp = l * (1.0 + (w * (log(l) + -1.0)));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -6.5e+88) tmp = Float64(l + fma(0.05555555555555555, Float64(l * Float64(w * w)), Float64(l * Float64(w * -0.3333333333333333)))); elseif ((w <= -1200000.0) || !(w <= 0.07)) tmp = log(exp(l)); else tmp = Float64(l * Float64(1.0 + Float64(w * Float64(log(l) + -1.0)))); end return tmp end
code[w_, l_] := If[LessEqual[w, -6.5e+88], N[(l + N[(0.05555555555555555 * N[(l * N[(w * w), $MachinePrecision]), $MachinePrecision] + N[(l * N[(w * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[w, -1200000.0], N[Not[LessEqual[w, 0.07]], $MachinePrecision]], N[Log[N[Exp[l], $MachinePrecision]], $MachinePrecision], N[(l * N[(1.0 + N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -6.5 \cdot 10^{+88}:\\
\;\;\;\;\ell + \mathsf{fma}\left(0.05555555555555555, \ell \cdot \left(w \cdot w\right), \ell \cdot \left(w \cdot -0.3333333333333333\right)\right)\\
\mathbf{elif}\;w \leq -1200000 \lor \neg \left(w \leq 0.07\right):\\
\;\;\;\;\log \left(e^{\ell}\right)\\
\mathbf{else}:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(\log \ell + -1\right)\right)\\
\end{array}
\end{array}
if w < -6.5000000000000002e88Initial program 100.0%
*-commutative100.0%
exp-neg100.0%
div-inv100.0%
add-cube-cbrt100.0%
associate-/r*100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 100.0%
Taylor expanded in w around 0 62.1%
+-commutative62.1%
fma-def62.1%
unpow262.1%
*-commutative62.1%
associate-*l*62.1%
Simplified62.1%
if -6.5000000000000002e88 < w < -1.2e6 or 0.070000000000000007 < w Initial program 96.6%
*-commutative96.6%
exp-neg96.6%
div-inv96.6%
add-cube-cbrt96.6%
associate-/r*96.6%
pow296.6%
Applied egg-rr96.6%
Taylor expanded in l around 0 96.6%
unpow1/396.6%
unpow296.6%
prod-exp96.6%
rec-exp96.6%
Simplified96.6%
Applied egg-rr29.5%
pow229.5%
inv-pow29.5%
pow-prod-up4.1%
metadata-eval4.1%
pow14.1%
add-log-exp70.1%
Applied egg-rr70.1%
if -1.2e6 < w < 0.070000000000000007Initial program 99.4%
Taylor expanded in w around 0 98.4%
mul-1-neg98.4%
+-commutative98.4%
sub-neg98.4%
Simplified98.4%
Taylor expanded in l around 0 98.4%
Final simplification84.4%
(FPCore (w l) :precision binary64 (/ l (cbrt (exp w))))
double code(double w, double l) {
return l / cbrt(exp(w));
}
public static double code(double w, double l) {
return l / Math.cbrt(Math.exp(w));
}
function code(w, l) return Float64(l / cbrt(exp(w))) end
code[w_, l_] := N[(l / N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{\sqrt[3]{e^{w}}}
\end{array}
Initial program 98.9%
*-commutative98.9%
exp-neg98.9%
div-inv98.9%
add-cube-cbrt98.9%
associate-/r*98.9%
pow298.9%
Applied egg-rr98.9%
Taylor expanded in w around 0 97.9%
Final simplification97.9%
(FPCore (w l)
:precision binary64
(if (<= w -1.3e+117)
(+ l (* -0.3333333333333333 (* l w)))
(if (<= w -520.0)
(/ (* l l) l)
(/
l
(+ 1.0 (fma 0.05555555555555555 (* w w) (* w 0.3333333333333333)))))))
double code(double w, double l) {
double tmp;
if (w <= -1.3e+117) {
tmp = l + (-0.3333333333333333 * (l * w));
} else if (w <= -520.0) {
tmp = (l * l) / l;
} else {
tmp = l / (1.0 + fma(0.05555555555555555, (w * w), (w * 0.3333333333333333)));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.3e+117) tmp = Float64(l + Float64(-0.3333333333333333 * Float64(l * w))); elseif (w <= -520.0) tmp = Float64(Float64(l * l) / l); else tmp = Float64(l / Float64(1.0 + fma(0.05555555555555555, Float64(w * w), Float64(w * 0.3333333333333333)))); end return tmp end
code[w_, l_] := If[LessEqual[w, -1.3e+117], N[(l + N[(-0.3333333333333333 * N[(l * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -520.0], N[(N[(l * l), $MachinePrecision] / l), $MachinePrecision], N[(l / N[(1.0 + N[(0.05555555555555555 * N[(w * w), $MachinePrecision] + N[(w * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.3 \cdot 10^{+117}:\\
\;\;\;\;\ell + -0.3333333333333333 \cdot \left(\ell \cdot w\right)\\
\mathbf{elif}\;w \leq -520:\\
\;\;\;\;\frac{\ell \cdot \ell}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + \mathsf{fma}\left(0.05555555555555555, w \cdot w, w \cdot 0.3333333333333333\right)}\\
\end{array}
\end{array}
if w < -1.3e117Initial program 100.0%
*-commutative100.0%
exp-neg100.0%
div-inv100.0%
add-cube-cbrt100.0%
associate-/r*100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 100.0%
Taylor expanded in w around 0 38.9%
if -1.3e117 < w < -520Initial program 100.0%
*-commutative100.0%
exp-neg100.0%
div-inv100.0%
add-cube-cbrt100.0%
associate-/r*100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in l around 0 100.0%
unpow1/3100.0%
unpow2100.0%
prod-exp100.0%
rec-exp100.0%
Simplified100.0%
Applied egg-rr18.7%
un-div-inv18.7%
Applied egg-rr18.7%
if -520 < w Initial program 98.4%
*-commutative98.4%
exp-neg98.4%
div-inv98.4%
add-cube-cbrt98.4%
associate-/r*98.4%
pow298.4%
Applied egg-rr98.4%
Taylor expanded in w around 0 97.0%
Taylor expanded in w around 0 90.2%
fma-def90.2%
unpow290.2%
*-commutative90.2%
Simplified90.2%
Final simplification71.2%
(FPCore (w l)
:precision binary64
(if (<= w 470000000.0)
(+
l
(fma 0.05555555555555555 (* l (* w w)) (* l (* w -0.3333333333333333))))
(/ l (+ 1.0 (fma 0.05555555555555555 (* w w) (* w 0.3333333333333333))))))
double code(double w, double l) {
double tmp;
if (w <= 470000000.0) {
tmp = l + fma(0.05555555555555555, (l * (w * w)), (l * (w * -0.3333333333333333)));
} else {
tmp = l / (1.0 + fma(0.05555555555555555, (w * w), (w * 0.3333333333333333)));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= 470000000.0) tmp = Float64(l + fma(0.05555555555555555, Float64(l * Float64(w * w)), Float64(l * Float64(w * -0.3333333333333333)))); else tmp = Float64(l / Float64(1.0 + fma(0.05555555555555555, Float64(w * w), Float64(w * 0.3333333333333333)))); end return tmp end
code[w_, l_] := If[LessEqual[w, 470000000.0], N[(l + N[(0.05555555555555555 * N[(l * N[(w * w), $MachinePrecision]), $MachinePrecision] + N[(l * N[(w * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(0.05555555555555555 * N[(w * w), $MachinePrecision] + N[(w * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 470000000:\\
\;\;\;\;\ell + \mathsf{fma}\left(0.05555555555555555, \ell \cdot \left(w \cdot w\right), \ell \cdot \left(w \cdot -0.3333333333333333\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + \mathsf{fma}\left(0.05555555555555555, w \cdot w, w \cdot 0.3333333333333333\right)}\\
\end{array}
\end{array}
if w < 4.7e8Initial program 98.7%
*-commutative98.7%
exp-neg98.7%
div-inv98.7%
add-cube-cbrt98.7%
associate-/r*98.7%
pow298.7%
Applied egg-rr98.7%
Taylor expanded in w around 0 97.6%
Taylor expanded in w around 0 78.7%
+-commutative78.7%
fma-def78.7%
unpow278.7%
*-commutative78.7%
associate-*l*78.7%
Simplified78.7%
if 4.7e8 < w Initial program 100.0%
*-commutative100.0%
exp-neg100.0%
div-inv100.0%
add-cube-cbrt100.0%
associate-/r*100.0%
pow2100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 100.0%
Taylor expanded in w around 0 62.9%
fma-def62.9%
unpow262.9%
*-commutative62.9%
Simplified62.9%
Final simplification76.7%
(FPCore (w l) :precision binary64 (if (or (<= w -2.1e+119) (and (not (<= w -3300000000.0)) (<= w 0.051))) (+ l (* -0.3333333333333333 (* l w))) (/ (* l l) l)))
double code(double w, double l) {
double tmp;
if ((w <= -2.1e+119) || (!(w <= -3300000000.0) && (w <= 0.051))) {
tmp = l + (-0.3333333333333333 * (l * w));
} else {
tmp = (l * 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 <= (-2.1d+119)) .or. (.not. (w <= (-3300000000.0d0))) .and. (w <= 0.051d0)) then
tmp = l + ((-0.3333333333333333d0) * (l * w))
else
tmp = (l * l) / l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -2.1e+119) || (!(w <= -3300000000.0) && (w <= 0.051))) {
tmp = l + (-0.3333333333333333 * (l * w));
} else {
tmp = (l * l) / l;
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -2.1e+119) or (not (w <= -3300000000.0) and (w <= 0.051)): tmp = l + (-0.3333333333333333 * (l * w)) else: tmp = (l * l) / l return tmp
function code(w, l) tmp = 0.0 if ((w <= -2.1e+119) || (!(w <= -3300000000.0) && (w <= 0.051))) tmp = Float64(l + Float64(-0.3333333333333333 * Float64(l * w))); else tmp = Float64(Float64(l * l) / l); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -2.1e+119) || (~((w <= -3300000000.0)) && (w <= 0.051))) tmp = l + (-0.3333333333333333 * (l * w)); else tmp = (l * l) / l; end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -2.1e+119], And[N[Not[LessEqual[w, -3300000000.0]], $MachinePrecision], LessEqual[w, 0.051]]], N[(l + N[(-0.3333333333333333 * N[(l * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(l * l), $MachinePrecision] / l), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.1 \cdot 10^{+119} \lor \neg \left(w \leq -3300000000\right) \land w \leq 0.051:\\
\;\;\;\;\ell + -0.3333333333333333 \cdot \left(\ell \cdot w\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell \cdot \ell}{\ell}\\
\end{array}
\end{array}
if w < -2.09999999999999983e119 or -3.3e9 < w < 0.0509999999999999967Initial program 99.5%
*-commutative99.5%
exp-neg99.5%
div-inv99.5%
add-cube-cbrt99.5%
associate-/r*99.5%
pow299.5%
Applied egg-rr99.5%
Taylor expanded in w around 0 98.1%
Taylor expanded in w around 0 85.4%
if -2.09999999999999983e119 < w < -3.3e9 or 0.0509999999999999967 < w Initial program 97.4%
*-commutative97.4%
exp-neg97.4%
div-inv97.4%
add-cube-cbrt97.4%
associate-/r*97.4%
pow297.4%
Applied egg-rr97.4%
Taylor expanded in l around 0 97.4%
unpow1/397.4%
unpow297.4%
prod-exp97.4%
rec-exp97.4%
Simplified97.4%
Applied egg-rr27.3%
un-div-inv27.3%
Applied egg-rr27.3%
Final simplification68.1%
(FPCore (w l) :precision binary64 (if (or (<= w -1200000.0) (not (<= w 0.036))) (/ (* l l) l) l))
double code(double w, double l) {
double tmp;
if ((w <= -1200000.0) || !(w <= 0.036)) {
tmp = (l * l) / 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 <= (-1200000.0d0)) .or. (.not. (w <= 0.036d0))) then
tmp = (l * l) / l
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -1200000.0) || !(w <= 0.036)) {
tmp = (l * l) / l;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -1200000.0) or not (w <= 0.036): tmp = (l * l) / l else: tmp = l return tmp
function code(w, l) tmp = 0.0 if ((w <= -1200000.0) || !(w <= 0.036)) tmp = Float64(Float64(l * l) / l); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -1200000.0) || ~((w <= 0.036))) tmp = (l * l) / l; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -1200000.0], N[Not[LessEqual[w, 0.036]], $MachinePrecision]], N[(N[(l * l), $MachinePrecision] / l), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1200000 \lor \neg \left(w \leq 0.036\right):\\
\;\;\;\;\frac{\ell \cdot \ell}{\ell}\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -1.2e6 or 0.0359999999999999973 < w Initial program 98.2%
*-commutative98.2%
exp-neg98.2%
div-inv98.2%
add-cube-cbrt98.2%
associate-/r*98.2%
pow298.2%
Applied egg-rr98.2%
Taylor expanded in l around 0 98.2%
unpow1/398.2%
unpow298.2%
prod-exp98.2%
rec-exp98.2%
Simplified98.2%
Applied egg-rr25.4%
un-div-inv25.4%
Applied egg-rr25.4%
if -1.2e6 < w < 0.0359999999999999973Initial program 99.4%
Taylor expanded in w around 0 97.0%
Final simplification65.7%
(FPCore (w l) :precision binary64 (if (<= l 0.00066) (/ l (+ 1.0 (* w 0.3333333333333333))) (+ l (* -0.3333333333333333 (* l w)))))
double code(double w, double l) {
double tmp;
if (l <= 0.00066) {
tmp = l / (1.0 + (w * 0.3333333333333333));
} else {
tmp = l + (-0.3333333333333333 * (l * w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 0.00066d0) then
tmp = l / (1.0d0 + (w * 0.3333333333333333d0))
else
tmp = l + ((-0.3333333333333333d0) * (l * w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (l <= 0.00066) {
tmp = l / (1.0 + (w * 0.3333333333333333));
} else {
tmp = l + (-0.3333333333333333 * (l * w));
}
return tmp;
}
def code(w, l): tmp = 0 if l <= 0.00066: tmp = l / (1.0 + (w * 0.3333333333333333)) else: tmp = l + (-0.3333333333333333 * (l * w)) return tmp
function code(w, l) tmp = 0.0 if (l <= 0.00066) tmp = Float64(l / Float64(1.0 + Float64(w * 0.3333333333333333))); else tmp = Float64(l + Float64(-0.3333333333333333 * Float64(l * w))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (l <= 0.00066) tmp = l / (1.0 + (w * 0.3333333333333333)); else tmp = l + (-0.3333333333333333 * (l * w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[l, 0.00066], N[(l / N[(1.0 + N[(w * 0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l + N[(-0.3333333333333333 * N[(l * w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.00066:\\
\;\;\;\;\frac{\ell}{1 + w \cdot 0.3333333333333333}\\
\mathbf{else}:\\
\;\;\;\;\ell + -0.3333333333333333 \cdot \left(\ell \cdot w\right)\\
\end{array}
\end{array}
if l < 6.6e-4Initial program 99.7%
*-commutative99.7%
exp-neg99.7%
div-inv99.7%
add-cube-cbrt99.7%
associate-/r*99.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in w around 0 98.9%
Taylor expanded in w around 0 56.2%
*-commutative56.2%
Simplified56.2%
if 6.6e-4 < l Initial program 97.6%
*-commutative97.6%
exp-neg97.6%
div-inv97.6%
add-cube-cbrt97.6%
associate-/r*97.6%
pow297.6%
Applied egg-rr97.6%
Taylor expanded in w around 0 96.5%
Taylor expanded in w around 0 82.9%
Final simplification67.0%
(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.9%
Taylor expanded in w around 0 56.2%
Final simplification56.2%
herbie shell --seed 2023283
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))