
(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 (/ (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.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
(FPCore (w l) :precision binary64 (* l (/ 1.0 (exp w))))
double code(double w, double l) {
return l * (1.0 / exp(w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l * (1.0d0 / exp(w))
end function
public static double code(double w, double l) {
return l * (1.0 / Math.exp(w));
}
def code(w, l): return l * (1.0 / math.exp(w))
function code(w, l) return Float64(l * Float64(1.0 / exp(w))) end
function tmp = code(w, l) tmp = l * (1.0 / exp(w)); end
code[w_, l_] := N[(l * N[(1.0 / N[Exp[w], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell \cdot \frac{1}{e^{w}}
\end{array}
Initial program 99.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in w around 0 98.3%
frac-2neg98.3%
div-inv98.3%
Applied egg-rr98.3%
Final simplification98.3%
(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.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in w around 0 98.3%
(FPCore (w l) :precision binary64 (if (<= w -0.215) (- l (* l (* w (- 1.0 (* w (+ 0.5 (* w -0.16666666666666666))))))) (/ l (+ 1.0 (* w (+ 1.0 (* w (* w 0.16666666666666666))))))))
double code(double w, double l) {
double tmp;
if (w <= -0.215) {
tmp = l - (l * (w * (1.0 - (w * (0.5 + (w * -0.16666666666666666))))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-0.215d0)) then
tmp = l - (l * (w * (1.0d0 - (w * (0.5d0 + (w * (-0.16666666666666666d0)))))))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * (w * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.215) {
tmp = l - (l * (w * (1.0 - (w * (0.5 + (w * -0.16666666666666666))))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666)))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.215: tmp = l - (l * (w * (1.0 - (w * (0.5 + (w * -0.16666666666666666)))))) else: tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666))))) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.215) tmp = Float64(l - Float64(l * Float64(w * Float64(1.0 - Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))))))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * Float64(w * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.215) tmp = l - (l * (w * (1.0 - (w * (0.5 + (w * -0.16666666666666666)))))); else tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666))))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.215], 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[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.215:\\
\;\;\;\;\ell - \ell \cdot \left(w \cdot \left(1 - w \cdot \left(0.5 + w \cdot -0.16666666666666666\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(w \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if w < -0.214999999999999997Initial 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 w around 0 100.0%
Taylor expanded in w around 0 68.2%
Taylor expanded in l around 0 77.4%
if -0.214999999999999997 < w Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 97.5%
Taylor expanded in w around 0 92.1%
*-commutative92.1%
Simplified92.1%
Taylor expanded in w around inf 92.1%
*-commutative92.1%
Simplified92.1%
Final simplification87.5%
(FPCore (w l) :precision binary64 (if (<= w 0.88) (+ l (* w (- (* w (* w (* l -0.16666666666666666))) l))) (/ l (+ 1.0 (* w (+ 1.0 (* w (* w 0.16666666666666666))))))))
double code(double w, double l) {
double tmp;
if (w <= 0.88) {
tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666)))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 0.88d0) then
tmp = l + (w * ((w * (w * (l * (-0.16666666666666666d0)))) - l))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * (w * 0.16666666666666666d0)))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 0.88) {
tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666)))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 0.88: tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l)) else: tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666))))) return tmp
function code(w, l) tmp = 0.0 if (w <= 0.88) tmp = Float64(l + Float64(w * Float64(Float64(w * Float64(w * Float64(l * -0.16666666666666666))) - l))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * Float64(w * 0.16666666666666666)))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 0.88) tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l)); else tmp = l / (1.0 + (w * (1.0 + (w * (w * 0.16666666666666666))))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 0.88], N[(l + N[(w * N[(N[(w * N[(w * N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.88:\\
\;\;\;\;\ell + w \cdot \left(w \cdot \left(w \cdot \left(\ell \cdot -0.16666666666666666\right)\right) - \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(w \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if w < 0.880000000000000004Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 98.5%
Taylor expanded in w around 0 86.6%
Taylor expanded in w around inf 86.6%
mul-1-neg86.6%
distribute-rgt-neg-in86.6%
distribute-rgt-out86.6%
metadata-eval86.6%
distribute-neg-in86.6%
mul-1-neg86.6%
distribute-rgt-out86.6%
metadata-eval86.6%
associate-*r*86.6%
metadata-eval86.6%
*-lft-identity86.6%
sub-neg86.6%
distribute-lft-out--86.6%
metadata-eval86.6%
Simplified86.6%
if 0.880000000000000004 < 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 w around 0 97.5%
Taylor expanded in w around 0 72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in w around inf 72.6%
*-commutative72.6%
Simplified72.6%
(FPCore (w l) :precision binary64 (if (<= w -2e-11) (+ l (* w (- (* w (* w (* l -0.16666666666666666))) l))) (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= -2e-11) {
tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-2d-11)) then
tmp = l + (w * ((w * (w * (l * (-0.16666666666666666d0)))) - l))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -2e-11) {
tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -2e-11: tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l)) else: tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= -2e-11) tmp = Float64(l + Float64(w * Float64(Float64(w * Float64(w * Float64(l * -0.16666666666666666))) - l))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -2e-11) tmp = l + (w * ((w * (w * (l * -0.16666666666666666))) - l)); else tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -2e-11], N[(l + N[(w * N[(N[(w * N[(w * N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2 \cdot 10^{-11}:\\
\;\;\;\;\ell + w \cdot \left(w \cdot \left(w \cdot \left(\ell \cdot -0.16666666666666666\right)\right) - \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < -1.99999999999999988e-11Initial program 99.9%
exp-neg99.9%
remove-double-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in w around 0 99.4%
Taylor expanded in w around 0 68.0%
Taylor expanded in w around inf 68.0%
mul-1-neg68.0%
distribute-rgt-neg-in68.0%
distribute-rgt-out68.0%
metadata-eval68.0%
distribute-neg-in68.0%
mul-1-neg68.0%
distribute-rgt-out68.0%
metadata-eval68.0%
associate-*r*68.0%
metadata-eval68.0%
*-lft-identity68.0%
sub-neg68.0%
distribute-lft-out--68.0%
metadata-eval68.0%
Simplified68.0%
if -1.99999999999999988e-11 < w Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 97.8%
Taylor expanded in w around 0 92.3%
*-commutative92.3%
Simplified92.3%
(FPCore (w l) :precision binary64 (if (<= w 128.0) (* l (+ 1.0 (* w (- -1.0 (* w -0.5))))) (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= 128.0) {
tmp = l * (1.0 + (w * (-1.0 - (w * -0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 128.0d0) then
tmp = l * (1.0d0 + (w * ((-1.0d0) - (w * (-0.5d0)))))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 128.0) {
tmp = l * (1.0 + (w * (-1.0 - (w * -0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 128.0: tmp = l * (1.0 + (w * (-1.0 - (w * -0.5)))) else: tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= 128.0) tmp = Float64(l * Float64(1.0 + Float64(w * Float64(-1.0 - Float64(w * -0.5))))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 128.0) tmp = l * (1.0 + (w * (-1.0 - (w * -0.5)))); else tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 128.0], N[(l * N[(1.0 + N[(w * N[(-1.0 - N[(w * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 128:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(-1 - w \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < 128Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 98.0%
frac-2neg98.0%
div-inv98.0%
Applied egg-rr98.0%
Taylor expanded in w around 0 85.7%
if 128 < 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 w around 0 100.0%
Taylor expanded in w around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification84.1%
(FPCore (w l) :precision binary64 (if (<= w 520.0) (- l (* w (- l (* w (* l 0.5))))) (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= 520.0) {
tmp = l - (w * (l - (w * (l * 0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 520.0d0) then
tmp = l - (w * (l - (w * (l * 0.5d0))))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 520.0) {
tmp = l - (w * (l - (w * (l * 0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 520.0: tmp = l - (w * (l - (w * (l * 0.5)))) else: tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= 520.0) tmp = Float64(l - Float64(w * Float64(l - Float64(w * Float64(l * 0.5))))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 520.0) tmp = l - (w * (l - (w * (l * 0.5)))); else tmp = l / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 520.0], N[(l - N[(w * N[(l - N[(w * N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 520:\\
\;\;\;\;\ell - w \cdot \left(\ell - w \cdot \left(\ell \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < 520Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 98.0%
Taylor expanded in w around 0 86.2%
Taylor expanded in w around 0 81.0%
distribute-rgt-out81.0%
metadata-eval81.0%
neg-mul-181.0%
associate-*r*81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
*-commutative81.0%
metadata-eval81.0%
associate-*r*81.0%
*-commutative81.0%
Simplified81.0%
if 520 < 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 w around 0 100.0%
Taylor expanded in w around 0 74.3%
*-commutative74.3%
Simplified74.3%
Final simplification80.0%
(FPCore (w l) :precision binary64 (if (<= w 98.0) (- l (* w (- l (* w (* l 0.5))))) (/ 1.0 (/ (+ w 1.0) l))))
double code(double w, double l) {
double tmp;
if (w <= 98.0) {
tmp = l - (w * (l - (w * (l * 0.5))));
} else {
tmp = 1.0 / ((w + 1.0) / l);
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 98.0d0) then
tmp = l - (w * (l - (w * (l * 0.5d0))))
else
tmp = 1.0d0 / ((w + 1.0d0) / l)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 98.0) {
tmp = l - (w * (l - (w * (l * 0.5))));
} else {
tmp = 1.0 / ((w + 1.0) / l);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 98.0: tmp = l - (w * (l - (w * (l * 0.5)))) else: tmp = 1.0 / ((w + 1.0) / l) return tmp
function code(w, l) tmp = 0.0 if (w <= 98.0) tmp = Float64(l - Float64(w * Float64(l - Float64(w * Float64(l * 0.5))))); else tmp = Float64(1.0 / Float64(Float64(w + 1.0) / l)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 98.0) tmp = l - (w * (l - (w * (l * 0.5)))); else tmp = 1.0 / ((w + 1.0) / l); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 98.0], N[(l - N[(w * N[(l - N[(w * N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(w + 1.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 98:\\
\;\;\;\;\ell - w \cdot \left(\ell - w \cdot \left(\ell \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{w + 1}{\ell}}\\
\end{array}
\end{array}
if w < 98Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 98.0%
Taylor expanded in w around 0 86.2%
Taylor expanded in w around 0 81.0%
distribute-rgt-out81.0%
metadata-eval81.0%
neg-mul-181.0%
associate-*r*81.0%
*-commutative81.0%
distribute-rgt-neg-in81.0%
*-commutative81.0%
metadata-eval81.0%
associate-*r*81.0%
*-commutative81.0%
Simplified81.0%
if 98 < w Initial program 100.0%
*-un-lft-identity100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
pow-prod-up0.0%
pow10.0%
add-sqr-sqrt0.0%
sqrt-unprod0.0%
sqr-neg0.0%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
pow1100.0%
inv-pow100.0%
exp-neg100.0%
pow1100.0%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
exp-neg100.0%
associate-/r/100.0%
Applied egg-rr100.0%
exp-neg100.0%
remove-double-div100.0%
associate-/r/100.0%
Applied egg-rr100.0%
Taylor expanded in w around 0 49.0%
+-commutative49.0%
Simplified49.0%
Final simplification76.4%
(FPCore (w l) :precision binary64 (if (<= w 0.125) (* l (- 1.0 w)) (/ 1.0 (/ (+ w 1.0) l))))
double code(double w, double l) {
double tmp;
if (w <= 0.125) {
tmp = l * (1.0 - w);
} else {
tmp = 1.0 / ((w + 1.0) / 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.125d0) then
tmp = l * (1.0d0 - w)
else
tmp = 1.0d0 / ((w + 1.0d0) / l)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 0.125) {
tmp = l * (1.0 - w);
} else {
tmp = 1.0 / ((w + 1.0) / l);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 0.125: tmp = l * (1.0 - w) else: tmp = 1.0 / ((w + 1.0) / l) return tmp
function code(w, l) tmp = 0.0 if (w <= 0.125) tmp = Float64(l * Float64(1.0 - w)); else tmp = Float64(1.0 / Float64(Float64(w + 1.0) / l)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 0.125) tmp = l * (1.0 - w); else tmp = 1.0 / ((w + 1.0) / l); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 0.125], N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[(w + 1.0), $MachinePrecision] / l), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.125:\\
\;\;\;\;\ell \cdot \left(1 - w\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{w + 1}{\ell}}\\
\end{array}
\end{array}
if w < 0.125Initial program 99.7%
Taylor expanded in w around 0 64.2%
neg-mul-164.2%
unsub-neg64.2%
Simplified64.2%
Taylor expanded in w around 0 72.5%
if 0.125 < w Initial program 100.0%
*-un-lft-identity100.0%
metadata-eval100.0%
metadata-eval100.0%
metadata-eval100.0%
pow-prod-up2.6%
pow12.6%
add-sqr-sqrt2.6%
sqrt-unprod2.6%
sqr-neg2.6%
sqrt-unprod0.0%
add-sqr-sqrt100.0%
pow1100.0%
inv-pow100.0%
exp-neg100.0%
pow1100.0%
sqrt-unprod100.0%
add-sqr-sqrt100.0%
exp-neg100.0%
associate-/r/100.0%
Applied egg-rr97.5%
exp-neg97.5%
remove-double-div97.5%
associate-/r/97.5%
Applied egg-rr97.5%
Taylor expanded in w around 0 47.8%
+-commutative47.8%
Simplified47.8%
Final simplification68.8%
(FPCore (w l) :precision binary64 (if (<= w 0.13) (* l (- 1.0 w)) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 0.13) {
tmp = l * (1.0 - w);
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= 0.13d0) then
tmp = l * (1.0d0 - w)
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 0.13) {
tmp = l * (1.0 - w);
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 0.13: tmp = l * (1.0 - w) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 0.13) tmp = Float64(l * Float64(1.0 - w)); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 0.13) tmp = l * (1.0 - w); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 0.13], N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.13:\\
\;\;\;\;\ell \cdot \left(1 - w\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 0.13Initial program 99.7%
Taylor expanded in w around 0 64.2%
neg-mul-164.2%
unsub-neg64.2%
Simplified64.2%
Taylor expanded in w around 0 72.5%
if 0.13 < 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 w around 0 97.5%
Taylor expanded in w around 0 44.6%
+-commutative47.8%
Simplified44.6%
Final simplification68.3%
(FPCore (w l) :precision binary64 (if (<= w -0.021) (* l (- w)) l))
double code(double w, double l) {
double tmp;
if (w <= -0.021) {
tmp = l * -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.021d0)) then
tmp = l * -w
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.021) {
tmp = l * -w;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.021: tmp = l * -w else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -0.021) tmp = Float64(l * Float64(-w)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.021) tmp = l * -w; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.021], N[(l * (-w)), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.021:\\
\;\;\;\;\ell \cdot \left(-w\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.0210000000000000013Initial program 100.0%
Taylor expanded in w around 0 5.4%
neg-mul-15.4%
unsub-neg5.4%
Simplified5.4%
Taylor expanded in w around 0 30.1%
Taylor expanded in w around inf 30.1%
neg-mul-130.1%
Simplified30.1%
if -0.0210000000000000013 < w Initial program 99.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
Taylor expanded in w around 0 97.5%
Taylor expanded in w around 0 77.4%
Final simplification62.4%
(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.8%
Taylor expanded in w around 0 69.1%
neg-mul-169.1%
unsub-neg69.1%
Simplified69.1%
Taylor expanded in w around 0 62.2%
Final simplification62.2%
(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.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in w around 0 98.3%
Taylor expanded in w around 0 54.0%
herbie shell --seed 2024114
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))