
(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 (sqrt (exp w)))) (/ (pow (pow l t_0) t_0) (exp w))))
double code(double w, double l) {
double t_0 = sqrt(exp(w));
return pow(pow(l, t_0), t_0) / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: t_0
t_0 = sqrt(exp(w))
code = ((l ** t_0) ** t_0) / exp(w)
end function
public static double code(double w, double l) {
double t_0 = Math.sqrt(Math.exp(w));
return Math.pow(Math.pow(l, t_0), t_0) / Math.exp(w);
}
def code(w, l): t_0 = math.sqrt(math.exp(w)) return math.pow(math.pow(l, t_0), t_0) / math.exp(w)
function code(w, l) t_0 = sqrt(exp(w)) return Float64(((l ^ t_0) ^ t_0) / exp(w)) end
function tmp = code(w, l) t_0 = sqrt(exp(w)); tmp = ((l ^ t_0) ^ t_0) / exp(w); end
code[w_, l_] := Block[{t$95$0 = N[Sqrt[N[Exp[w], $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[Power[l, t$95$0], $MachinePrecision], t$95$0], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt{e^{w}}\\
\frac{{\left({\ell}^{t\_0}\right)}^{t\_0}}{e^{w}}
\end{array}
\end{array}
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 l around inf 94.8%
mul-1-neg94.8%
*-commutative94.8%
distribute-lft-neg-in94.8%
log-rec94.8%
remove-double-div94.8%
Simplified94.8%
pow-to-exp99.7%
add-sqr-sqrt99.6%
pow-unpow99.7%
Applied egg-rr99.7%
(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.7%
(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.7%
exp-neg99.7%
remove-double-neg99.7%
associate-*l/99.7%
*-lft-identity99.7%
remove-double-neg99.7%
Simplified99.7%
(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(Float64(-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}
\\
\ell \cdot e^{-w}
\end{array}
Initial program 99.7%
add-sqr-sqrt44.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod38.0%
add-sqr-sqrt81.8%
add-sqr-sqrt81.8%
sqrt-unprod81.8%
add-sqr-sqrt38.0%
sqrt-unprod66.6%
sqr-neg66.6%
sqrt-unprod28.6%
add-sqr-sqrt56.9%
pow156.9%
exp-neg56.9%
inv-pow56.9%
pow-prod-up97.9%
metadata-eval97.9%
metadata-eval97.9%
metadata-eval97.9%
Applied egg-rr97.9%
Taylor expanded in w around inf 97.9%
(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.7%
add-sqr-sqrt44.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod38.0%
add-sqr-sqrt81.8%
add-sqr-sqrt81.8%
sqrt-unprod81.8%
add-sqr-sqrt38.0%
sqrt-unprod66.6%
sqr-neg66.6%
sqrt-unprod28.6%
add-sqr-sqrt56.9%
pow156.9%
exp-neg56.9%
inv-pow56.9%
pow-prod-up97.9%
metadata-eval97.9%
metadata-eval97.9%
metadata-eval97.9%
Applied egg-rr97.9%
Taylor expanded in w around inf 97.9%
exp-neg97.9%
associate-*r/97.9%
*-rgt-identity97.9%
rem-exp-log93.0%
rem-exp-log97.9%
Simplified97.9%
(FPCore (w l) :precision binary64 (if (<= w 1.8e-6) (* l (+ 1.0 (* w (+ (* w (+ 0.5 (* w -0.16666666666666666))) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 1.8e-6) {
tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
} 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 <= 1.8d-6) then
tmp = l * (1.0d0 + (w * ((w * (0.5d0 + (w * (-0.16666666666666666d0)))) + (-1.0d0))))
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.8e-6) {
tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.8e-6: tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0))) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.8e-6) tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))) + -1.0)))); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.8e-6) tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0))); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l * N[(1.0 + N[(w * N[(N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 1.79999999999999992e-6Initial program 99.7%
add-sqr-sqrt34.3%
sqrt-unprod79.5%
sqr-neg79.5%
sqrt-unprod45.2%
add-sqr-sqrt79.0%
add-sqr-sqrt79.0%
sqrt-unprod79.0%
add-sqr-sqrt45.2%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod33.8%
add-sqr-sqrt67.4%
pow167.4%
exp-neg67.4%
inv-pow67.4%
pow-prod-up98.1%
metadata-eval98.1%
metadata-eval98.1%
metadata-eval98.1%
Applied egg-rr98.1%
Taylor expanded in w around 0 90.5%
if 1.79999999999999992e-6 < w Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
sqr-neg99.5%
sqrt-unprod0.0%
add-sqr-sqrt96.6%
add-sqr-sqrt96.6%
sqrt-unprod96.6%
add-sqr-sqrt0.0%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
pow11.6%
exp-neg1.6%
inv-pow1.6%
pow-prod-up96.7%
metadata-eval96.7%
metadata-eval96.7%
metadata-eval96.7%
Applied egg-rr49.1%
Final simplification83.9%
(FPCore (w l) :precision binary64 (if (<= w 1.9e-6) (+ l (* l (* w (+ (* w (+ 0.5 (* w -0.16666666666666666))) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 1.9e-6) {
tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
} 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 <= 1.9d-6) then
tmp = l + (l * (w * ((w * (0.5d0 + (w * (-0.16666666666666666d0)))) + (-1.0d0))))
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.9e-6) {
tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.9e-6: tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0))) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.9e-6) tmp = Float64(l + Float64(l * Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))) + -1.0)))); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.9e-6) tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0))); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.9e-6], N[(l + N[(l * N[(w * N[(N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 1.9e-6Initial program 99.7%
add-sqr-sqrt34.3%
sqrt-unprod79.5%
sqr-neg79.5%
sqrt-unprod45.2%
add-sqr-sqrt79.0%
add-sqr-sqrt79.0%
sqrt-unprod79.0%
add-sqr-sqrt45.2%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod33.8%
add-sqr-sqrt67.4%
pow167.4%
exp-neg67.4%
inv-pow67.4%
pow-prod-up98.1%
metadata-eval98.1%
metadata-eval98.1%
metadata-eval98.1%
Applied egg-rr98.1%
Taylor expanded in w around 0 88.0%
Taylor expanded in l around 0 90.5%
if 1.9e-6 < w Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
sqr-neg99.5%
sqrt-unprod0.0%
add-sqr-sqrt96.6%
add-sqr-sqrt96.6%
sqrt-unprod96.6%
add-sqr-sqrt0.0%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
pow11.6%
exp-neg1.6%
inv-pow1.6%
pow-prod-up96.7%
metadata-eval96.7%
metadata-eval96.7%
metadata-eval96.7%
Applied egg-rr49.1%
Final simplification83.9%
(FPCore (w l) :precision binary64 (if (<= w 1.75e-6) (* l (+ 1.0 (* w (+ (* w 0.5) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 1.75e-6) {
tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
} 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 <= 1.75d-6) then
tmp = l * (1.0d0 + (w * ((w * 0.5d0) + (-1.0d0))))
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.75e-6) {
tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.75e-6: tmp = l * (1.0 + (w * ((w * 0.5) + -1.0))) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.75e-6) tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * 0.5) + -1.0)))); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.75e-6) tmp = l * (1.0 + (w * ((w * 0.5) + -1.0))); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.75e-6], N[(l * N[(1.0 + N[(w * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot 0.5 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 1.74999999999999997e-6Initial program 99.7%
add-sqr-sqrt34.3%
sqrt-unprod79.5%
sqr-neg79.5%
sqrt-unprod45.2%
add-sqr-sqrt79.0%
add-sqr-sqrt79.0%
sqrt-unprod79.0%
add-sqr-sqrt45.2%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod33.8%
add-sqr-sqrt67.4%
pow167.4%
exp-neg67.4%
inv-pow67.4%
pow-prod-up98.1%
metadata-eval98.1%
metadata-eval98.1%
metadata-eval98.1%
Applied egg-rr98.1%
Taylor expanded in w around 0 86.1%
if 1.74999999999999997e-6 < w Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
sqr-neg99.5%
sqrt-unprod0.0%
add-sqr-sqrt96.6%
add-sqr-sqrt96.6%
sqrt-unprod96.6%
add-sqr-sqrt0.0%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
pow11.6%
exp-neg1.6%
inv-pow1.6%
pow-prod-up96.7%
metadata-eval96.7%
metadata-eval96.7%
metadata-eval96.7%
Applied egg-rr49.1%
Final simplification80.2%
(FPCore (w l) :precision binary64 (if (<= w 1.8e-6) (+ l (* w (* l (+ (* w 0.5) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 1.8e-6) {
tmp = l + (w * (l * ((w * 0.5) + -1.0)));
} 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 <= 1.8d-6) then
tmp = l + (w * (l * ((w * 0.5d0) + (-1.0d0))))
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 1.8e-6) {
tmp = l + (w * (l * ((w * 0.5) + -1.0)));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.8e-6: tmp = l + (w * (l * ((w * 0.5) + -1.0))) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.8e-6) tmp = Float64(l + Float64(w * Float64(l * Float64(Float64(w * 0.5) + -1.0)))); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 1.8e-6) tmp = l + (w * (l * ((w * 0.5) + -1.0))); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l + N[(w * N[(l * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell + w \cdot \left(\ell \cdot \left(w \cdot 0.5 + -1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 1.79999999999999992e-6Initial program 99.7%
add-sqr-sqrt34.3%
sqrt-unprod79.5%
sqr-neg79.5%
sqrt-unprod45.2%
add-sqr-sqrt79.0%
add-sqr-sqrt79.0%
sqrt-unprod79.0%
add-sqr-sqrt45.2%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod33.8%
add-sqr-sqrt67.4%
pow167.4%
exp-neg67.4%
inv-pow67.4%
pow-prod-up98.1%
metadata-eval98.1%
metadata-eval98.1%
metadata-eval98.1%
Applied egg-rr98.1%
Taylor expanded in w around 0 88.0%
Taylor expanded in w around 0 82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
associate-*r*82.2%
distribute-lft-out82.2%
*-commutative82.2%
Simplified82.2%
if 1.79999999999999992e-6 < w Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
sqr-neg99.5%
sqrt-unprod0.0%
add-sqr-sqrt96.6%
add-sqr-sqrt96.6%
sqrt-unprod96.6%
add-sqr-sqrt0.0%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
pow11.6%
exp-neg1.6%
inv-pow1.6%
pow-prod-up96.7%
metadata-eval96.7%
metadata-eval96.7%
metadata-eval96.7%
Applied egg-rr49.1%
Final simplification76.9%
(FPCore (w l) :precision binary64 (if (<= w 1.8e-6) (* l (+ -1.0 (- 2.0 w))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 1.8e-6) {
tmp = l * (-1.0 + (2.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 <= 1.8d-6) then
tmp = l * ((-1.0d0) + (2.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 <= 1.8e-6) {
tmp = l * (-1.0 + (2.0 - w));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 1.8e-6: tmp = l * (-1.0 + (2.0 - w)) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 1.8e-6) tmp = Float64(l * Float64(-1.0 + Float64(2.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 <= 1.8e-6) tmp = l * (-1.0 + (2.0 - w)); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l * N[(-1.0 + N[(2.0 - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(-1 + \left(2 - w\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 1.79999999999999992e-6Initial program 99.7%
add-sqr-sqrt34.3%
sqrt-unprod79.5%
sqr-neg79.5%
sqrt-unprod45.2%
add-sqr-sqrt79.0%
add-sqr-sqrt79.0%
sqrt-unprod79.0%
add-sqr-sqrt45.2%
sqrt-unprod79.0%
sqr-neg79.0%
sqrt-unprod33.8%
add-sqr-sqrt67.4%
pow167.4%
exp-neg67.4%
inv-pow67.4%
pow-prod-up98.1%
metadata-eval98.1%
metadata-eval98.1%
metadata-eval98.1%
Applied egg-rr98.1%
Taylor expanded in w around 0 88.0%
Taylor expanded in w around 0 73.6%
*-rgt-identity73.6%
neg-mul-173.6%
distribute-rgt-neg-in73.6%
distribute-lft-out73.6%
sub-neg73.6%
Simplified73.6%
expm1-log1p-u73.6%
Applied egg-rr73.6%
expm1-undefine73.6%
sub-neg73.6%
log1p-undefine73.6%
rem-exp-log73.6%
associate-+r-73.6%
metadata-eval73.6%
metadata-eval73.6%
Simplified73.6%
if 1.79999999999999992e-6 < w Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
add-sqr-sqrt99.5%
sqrt-unprod99.5%
sqr-neg99.5%
sqrt-unprod0.0%
add-sqr-sqrt96.6%
add-sqr-sqrt96.6%
sqrt-unprod96.6%
add-sqr-sqrt0.0%
sqrt-unprod1.6%
sqr-neg1.6%
sqrt-unprod1.6%
add-sqr-sqrt1.6%
pow11.6%
exp-neg1.6%
inv-pow1.6%
pow-prod-up96.7%
metadata-eval96.7%
metadata-eval96.7%
metadata-eval96.7%
Applied egg-rr49.1%
Final simplification69.7%
(FPCore (w l) :precision binary64 (if (<= w -0.38) (* w (- l)) l))
double code(double w, double l) {
double tmp;
if (w <= -0.38) {
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.38d0)) 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.38) {
tmp = w * -l;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.38: tmp = w * -l else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -0.38) tmp = Float64(w * Float64(-l)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.38) tmp = w * -l; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.38], N[(w * (-l)), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.38:\\
\;\;\;\;w \cdot \left(-\ell\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.38Initial program 100.0%
add-sqr-sqrt0.0%
sqrt-unprod37.4%
sqr-neg37.4%
sqrt-unprod37.4%
add-sqr-sqrt37.4%
add-sqr-sqrt37.4%
sqrt-unprod37.4%
add-sqr-sqrt37.4%
sqrt-unprod37.4%
sqr-neg37.4%
sqrt-unprod0.0%
add-sqr-sqrt0.1%
pow10.1%
exp-neg0.1%
inv-pow0.1%
pow-prod-up98.6%
metadata-eval98.6%
metadata-eval98.6%
metadata-eval98.6%
Applied egg-rr98.6%
Taylor expanded in w around 0 65.9%
Taylor expanded in w around 0 19.8%
*-rgt-identity19.8%
neg-mul-119.8%
distribute-rgt-neg-in19.8%
distribute-lft-out19.8%
sub-neg19.8%
Simplified19.8%
Taylor expanded in w around inf 19.8%
mul-1-neg19.8%
distribute-lft-neg-out19.8%
*-commutative19.8%
Simplified19.8%
if -0.38 < w Initial program 99.6%
Taylor expanded in w around 0 78.2%
(FPCore (w l) :precision binary64 (* l (+ -1.0 (- 2.0 w))))
double code(double w, double l) {
return l * (-1.0 + (2.0 - w));
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l * ((-1.0d0) + (2.0d0 - w))
end function
public static double code(double w, double l) {
return l * (-1.0 + (2.0 - w));
}
def code(w, l): return l * (-1.0 + (2.0 - w))
function code(w, l) return Float64(l * Float64(-1.0 + Float64(2.0 - w))) end
function tmp = code(w, l) tmp = l * (-1.0 + (2.0 - w)); end
code[w_, l_] := N[(l * N[(-1.0 + N[(2.0 - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell \cdot \left(-1 + \left(2 - w\right)\right)
\end{array}
Initial program 99.7%
add-sqr-sqrt44.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod38.0%
add-sqr-sqrt81.8%
add-sqr-sqrt81.8%
sqrt-unprod81.8%
add-sqr-sqrt38.0%
sqrt-unprod66.6%
sqr-neg66.6%
sqrt-unprod28.6%
add-sqr-sqrt56.9%
pow156.9%
exp-neg56.9%
inv-pow56.9%
pow-prod-up97.9%
metadata-eval97.9%
metadata-eval97.9%
metadata-eval97.9%
Applied egg-rr97.9%
Taylor expanded in w around 0 74.5%
Taylor expanded in w around 0 62.6%
*-rgt-identity62.6%
neg-mul-162.6%
distribute-rgt-neg-in62.6%
distribute-lft-out62.6%
sub-neg62.6%
Simplified62.6%
expm1-log1p-u62.1%
Applied egg-rr62.1%
expm1-undefine62.1%
sub-neg62.1%
log1p-undefine62.1%
rem-exp-log62.6%
associate-+r-62.6%
metadata-eval62.6%
metadata-eval62.6%
Simplified62.6%
Final simplification62.6%
(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.7%
add-sqr-sqrt44.7%
sqrt-unprod82.7%
sqr-neg82.7%
sqrt-unprod38.0%
add-sqr-sqrt81.8%
add-sqr-sqrt81.8%
sqrt-unprod81.8%
add-sqr-sqrt38.0%
sqrt-unprod66.6%
sqr-neg66.6%
sqrt-unprod28.6%
add-sqr-sqrt56.9%
pow156.9%
exp-neg56.9%
inv-pow56.9%
pow-prod-up97.9%
metadata-eval97.9%
metadata-eval97.9%
metadata-eval97.9%
Applied egg-rr97.9%
Taylor expanded in w around 0 74.5%
Taylor expanded in w around 0 62.6%
*-rgt-identity62.6%
neg-mul-162.6%
distribute-rgt-neg-in62.6%
distribute-lft-out62.6%
sub-neg62.6%
Simplified62.6%
(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.7%
Taylor expanded in w around 0 58.7%
herbie shell --seed 2024130
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))