
(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 12 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.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 (/ 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-sqrt43.3%
sqrt-unprod84.6%
sqr-neg84.6%
sqrt-unprod41.3%
add-sqr-sqrt84.2%
add-sqr-sqrt84.2%
sqrt-unprod84.2%
add-sqr-sqrt41.3%
sqrt-unprod70.5%
sqr-neg70.5%
sqrt-unprod29.2%
add-sqr-sqrt54.5%
pow154.5%
exp-neg54.5%
inv-pow54.5%
pow-prod-up98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
Applied egg-rr98.3%
Taylor expanded in l around 0 98.3%
(FPCore (w l)
:precision binary64
(let* ((t_0 (- l (* l 0.5))))
(if (<= w -5e-17)
(-
l
(*
w
(-
l
(* w (- t_0 (* w (+ t_0 (+ (* l -0.5) (* l 0.16666666666666666)))))))))
(/ l (+ 1.0 (* w (+ 1.0 (* w (+ 0.5 (* w 0.16666666666666666))))))))))
double code(double w, double l) {
double t_0 = l - (l * 0.5);
double tmp;
if (w <= -5e-17) {
tmp = l - (w * (l - (w * (t_0 - (w * (t_0 + ((l * -0.5) + (l * 0.16666666666666666))))))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = l - (l * 0.5d0)
if (w <= (-5d-17)) then
tmp = l - (w * (l - (w * (t_0 - (w * (t_0 + ((l * (-0.5d0)) + (l * 0.16666666666666666d0))))))))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * (0.5d0 + (w * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = l - (l * 0.5);
double tmp;
if (w <= -5e-17) {
tmp = l - (w * (l - (w * (t_0 - (w * (t_0 + ((l * -0.5) + (l * 0.16666666666666666))))))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
}
return tmp;
}
def code(w, l): t_0 = l - (l * 0.5) tmp = 0 if w <= -5e-17: tmp = l - (w * (l - (w * (t_0 - (w * (t_0 + ((l * -0.5) + (l * 0.16666666666666666)))))))) else: tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))) return tmp
function code(w, l) t_0 = Float64(l - Float64(l * 0.5)) tmp = 0.0 if (w <= -5e-17) tmp = Float64(l - Float64(w * Float64(l - Float64(w * Float64(t_0 - Float64(w * Float64(t_0 + Float64(Float64(l * -0.5) + Float64(l * 0.16666666666666666))))))))); else tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * Float64(0.5 + Float64(w * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(w, l) t_0 = l - (l * 0.5); tmp = 0.0; if (w <= -5e-17) tmp = l - (w * (l - (w * (t_0 - (w * (t_0 + ((l * -0.5) + (l * 0.16666666666666666)))))))); else tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[(l - N[(l * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -5e-17], N[(l - N[(w * N[(l - N[(w * N[(t$95$0 - N[(w * N[(t$95$0 + N[(N[(l * -0.5), $MachinePrecision] + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * N[(0.5 + N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell - \ell \cdot 0.5\\
\mathbf{if}\;w \leq -5 \cdot 10^{-17}:\\
\;\;\;\;\ell - w \cdot \left(\ell - w \cdot \left(t\_0 - w \cdot \left(t\_0 + \left(\ell \cdot -0.5 + \ell \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if w < -4.9999999999999999e-17Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
add-sqr-sqrt0.0%
sqrt-unprod53.9%
sqr-neg53.9%
sqrt-unprod53.9%
add-sqr-sqrt53.9%
add-sqr-sqrt53.9%
sqrt-unprod53.9%
add-sqr-sqrt53.9%
sqrt-unprod53.9%
sqr-neg53.9%
sqrt-unprod0.0%
add-sqr-sqrt4.6%
pow14.6%
exp-neg4.6%
inv-pow4.6%
pow-prod-up97.4%
metadata-eval97.4%
metadata-eval97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in w around 0 72.5%
if -4.9999999999999999e-17 < w 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-sqrt64.0%
sqrt-unprod99.3%
sqr-neg99.3%
sqrt-unprod35.3%
add-sqr-sqrt98.7%
add-sqr-sqrt98.7%
sqrt-unprod98.7%
add-sqr-sqrt35.3%
sqrt-unprod78.4%
sqr-neg78.4%
sqrt-unprod43.2%
add-sqr-sqrt78.4%
pow178.4%
exp-neg78.4%
inv-pow78.4%
pow-prod-up98.7%
metadata-eval98.7%
metadata-eval98.7%
metadata-eval98.7%
Applied egg-rr98.7%
Taylor expanded in l around 0 98.7%
Taylor expanded in w around 0 93.8%
*-commutative93.8%
Simplified93.8%
Final simplification86.9%
(FPCore (w l) :precision binary64 (if (<= w 112000000.0) (* l (+ 1.0 (* w (+ -1.0 (* w 0.5))))) (/ l (+ 1.0 (* w (+ 1.0 (* w (+ 0.5 (* w 0.16666666666666666)))))))))
double code(double w, double l) {
double tmp;
if (w <= 112000000.0) {
tmp = l * (1.0 + (w * (-1.0 + (w * 0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (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 <= 112000000.0d0) then
tmp = l * (1.0d0 + (w * ((-1.0d0) + (w * 0.5d0))))
else
tmp = l / (1.0d0 + (w * (1.0d0 + (w * (0.5d0 + (w * 0.16666666666666666d0))))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 112000000.0) {
tmp = l * (1.0 + (w * (-1.0 + (w * 0.5))));
} else {
tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 112000000.0: tmp = l * (1.0 + (w * (-1.0 + (w * 0.5)))) else: tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))) return tmp
function code(w, l) tmp = 0.0 if (w <= 112000000.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 * Float64(0.5 + Float64(w * 0.16666666666666666))))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 112000000.0) tmp = l * (1.0 + (w * (-1.0 + (w * 0.5)))); else tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 112000000.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 * N[(0.5 + N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 112000000:\\
\;\;\;\;\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 \left(0.5 + w \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if w < 1.12e8Initial program 99.2%
Taylor expanded in w around 0 85.4%
add-sqr-sqrt34.6%
sqrt-unprod82.2%
sqr-neg82.2%
sqrt-unprod47.6%
add-sqr-sqrt81.7%
add-sqr-sqrt81.7%
sqrt-unprod81.7%
add-sqr-sqrt47.6%
sqrt-unprod81.3%
sqr-neg81.3%
sqrt-unprod33.7%
add-sqr-sqrt62.9%
pow162.9%
exp-neg62.9%
inv-pow62.9%
pow-prod-up98.0%
metadata-eval98.0%
metadata-eval98.0%
metadata-eval98.0%
Applied egg-rr86.9%
if 1.12e8 < 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 l around 0 100.0%
Taylor expanded in w around 0 77.8%
*-commutative77.8%
Simplified77.8%
Final simplification85.7%
(FPCore (w l) :precision binary64 (if (<= w 530000000.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 <= 530000000.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 <= 530000000.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 <= 530000000.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 <= 530000000.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 <= 530000000.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 <= 530000000.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, 530000000.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 530000000:\\
\;\;\;\;\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 < 5.3e8Initial program 99.2%
Taylor expanded in w around 0 85.4%
add-sqr-sqrt34.6%
sqrt-unprod82.2%
sqr-neg82.2%
sqrt-unprod47.6%
add-sqr-sqrt81.7%
add-sqr-sqrt81.7%
sqrt-unprod81.7%
add-sqr-sqrt47.6%
sqrt-unprod81.3%
sqr-neg81.3%
sqrt-unprod33.7%
add-sqr-sqrt62.9%
pow162.9%
exp-neg62.9%
inv-pow62.9%
pow-prod-up98.0%
metadata-eval98.0%
metadata-eval98.0%
metadata-eval98.0%
Applied egg-rr86.9%
if 5.3e8 < 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 l around 0 100.0%
Taylor expanded in w around 0 66.9%
*-commutative66.9%
Simplified66.9%
Final simplification84.3%
(FPCore (w l) :precision binary64 (if (<= w 300000000.0) (+ l (* l (* 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 <= 300000000.0) {
tmp = l + (l * (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 <= 300000000.0d0) then
tmp = l + (l * (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 <= 300000000.0) {
tmp = l + (l * (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 <= 300000000.0: tmp = l + (l * (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 <= 300000000.0) tmp = Float64(l + Float64(l * 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 <= 300000000.0) tmp = l + (l * (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, 300000000.0], N[(l + N[(l * 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 300000000:\\
\;\;\;\;\ell + \ell \cdot \left(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 < 3e8Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
add-sqr-sqrt34.6%
sqrt-unprod82.2%
sqr-neg82.2%
sqrt-unprod47.6%
add-sqr-sqrt81.7%
add-sqr-sqrt81.7%
sqrt-unprod81.7%
add-sqr-sqrt47.6%
sqrt-unprod81.3%
sqr-neg81.3%
sqrt-unprod33.7%
add-sqr-sqrt62.9%
pow162.9%
exp-neg62.9%
inv-pow62.9%
pow-prod-up98.0%
metadata-eval98.0%
metadata-eval98.0%
metadata-eval98.0%
Applied egg-rr98.0%
Taylor expanded in w around 0 82.3%
associate-*r*82.3%
neg-mul-182.3%
distribute-rgt-out82.3%
metadata-eval82.3%
Simplified82.3%
Taylor expanded in l around 0 86.9%
if 3e8 < 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 l around 0 100.0%
Taylor expanded in w around 0 66.9%
*-commutative66.9%
Simplified66.9%
Final simplification84.3%
(FPCore (w l) :precision binary64 (if (<= w 44000000.0) (+ l (* l (* w (+ -1.0 (* w 0.5))))) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 44000000.0) {
tmp = l + (l * (w * (-1.0 + (w * 0.5))));
} 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 <= 44000000.0d0) then
tmp = l + (l * (w * ((-1.0d0) + (w * 0.5d0))))
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 44000000.0) {
tmp = l + (l * (w * (-1.0 + (w * 0.5))));
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 44000000.0: tmp = l + (l * (w * (-1.0 + (w * 0.5)))) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 44000000.0) tmp = Float64(l + Float64(l * Float64(w * Float64(-1.0 + Float64(w * 0.5))))); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 44000000.0) tmp = l + (l * (w * (-1.0 + (w * 0.5)))); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 44000000.0], N[(l + N[(l * N[(w * N[(-1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 44000000:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(-1 + w \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < 4.4e7Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
add-sqr-sqrt34.6%
sqrt-unprod82.2%
sqr-neg82.2%
sqrt-unprod47.6%
add-sqr-sqrt81.7%
add-sqr-sqrt81.7%
sqrt-unprod81.7%
add-sqr-sqrt47.6%
sqrt-unprod81.3%
sqr-neg81.3%
sqrt-unprod33.7%
add-sqr-sqrt62.9%
pow162.9%
exp-neg62.9%
inv-pow62.9%
pow-prod-up98.0%
metadata-eval98.0%
metadata-eval98.0%
metadata-eval98.0%
Applied egg-rr98.0%
Taylor expanded in w around 0 82.3%
associate-*r*82.3%
neg-mul-182.3%
distribute-rgt-out82.3%
metadata-eval82.3%
Simplified82.3%
Taylor expanded in l around 0 86.9%
if 4.4e7 < 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 l around 0 100.0%
Taylor expanded in w around 0 45.5%
+-commutative45.5%
Simplified45.5%
Final simplification81.4%
(FPCore (w l) :precision binary64 (if (<= w -3.1e-16) (* w (- (/ l w) l)) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -3.1e-16) {
tmp = w * ((l / w) - l);
} 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 <= (-3.1d-16)) then
tmp = w * ((l / w) - l)
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -3.1e-16) {
tmp = w * ((l / w) - l);
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -3.1e-16: tmp = w * ((l / w) - l) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -3.1e-16) tmp = Float64(w * Float64(Float64(l / w) - l)); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -3.1e-16) tmp = w * ((l / w) - l); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -3.1e-16], N[(w * N[(N[(l / w), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -3.1 \cdot 10^{-16}:\\
\;\;\;\;w \cdot \left(\frac{\ell}{w} - \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < -3.1000000000000001e-16Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
add-sqr-sqrt0.0%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-unprod53.4%
add-sqr-sqrt53.4%
add-sqr-sqrt53.4%
sqrt-unprod53.4%
add-sqr-sqrt53.4%
sqrt-unprod53.4%
sqr-neg53.4%
sqrt-unprod0.0%
add-sqr-sqrt3.5%
pow13.5%
exp-neg3.5%
inv-pow3.5%
pow-prod-up97.4%
metadata-eval97.4%
metadata-eval97.4%
metadata-eval97.4%
Applied egg-rr97.4%
Taylor expanded in w around 0 27.9%
mul-1-neg27.9%
unsub-neg27.9%
Simplified27.9%
Taylor expanded in w around inf 27.9%
if -3.1000000000000001e-16 < w 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-sqrt63.7%
sqrt-unprod99.3%
sqr-neg99.3%
sqrt-unprod35.6%
add-sqr-sqrt98.6%
add-sqr-sqrt98.6%
sqrt-unprod98.6%
add-sqr-sqrt35.6%
sqrt-unprod78.5%
sqr-neg78.5%
sqrt-unprod42.9%
add-sqr-sqrt78.6%
pow178.6%
exp-neg78.5%
inv-pow78.6%
pow-prod-up98.7%
metadata-eval98.7%
metadata-eval98.7%
metadata-eval98.7%
Applied egg-rr98.7%
Taylor expanded in l around 0 98.7%
Taylor expanded in w around 0 87.5%
+-commutative87.5%
Simplified87.5%
(FPCore (w l) :precision binary64 (if (<= w -0.026) (* l (- w)) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -0.026) {
tmp = l * -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.026d0)) then
tmp = l * -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.026) {
tmp = l * -w;
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.026: tmp = l * -w else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.026) tmp = Float64(l * Float64(-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.026) tmp = l * -w; else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.026], N[(l * (-w)), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.026:\\
\;\;\;\;\ell \cdot \left(-w\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < -0.0259999999999999988Initial 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-unprod53.2%
sqr-neg53.2%
sqrt-unprod53.2%
add-sqr-sqrt53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
sqr-neg53.2%
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 26.0%
mul-1-neg26.0%
unsub-neg26.0%
Simplified26.0%
Taylor expanded in w around inf 26.0%
associate-*r*26.0%
neg-mul-126.0%
*-commutative26.0%
Simplified26.0%
if -0.0259999999999999988 < w Initial program 99.0%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
add-sqr-sqrt61.9%
sqrt-unprod98.1%
sqr-neg98.1%
sqrt-unprod36.2%
add-sqr-sqrt97.5%
add-sqr-sqrt97.5%
sqrt-unprod97.5%
add-sqr-sqrt36.2%
sqrt-unprod77.9%
sqr-neg77.9%
sqrt-unprod41.7%
add-sqr-sqrt78.0%
pow178.0%
exp-neg78.0%
inv-pow78.0%
pow-prod-up97.5%
metadata-eval97.5%
metadata-eval97.5%
metadata-eval97.5%
Applied egg-rr97.5%
Taylor expanded in l around 0 97.5%
Taylor expanded in w around 0 86.7%
+-commutative86.7%
Simplified86.7%
Final simplification68.4%
(FPCore (w l) :precision binary64 (if (<= w -25.5) (* l (- w)) l))
double code(double w, double l) {
double tmp;
if (w <= -25.5) {
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 <= (-25.5d0)) 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 <= -25.5) {
tmp = l * -w;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -25.5: tmp = l * -w else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -25.5) tmp = Float64(l * Float64(-w)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -25.5) tmp = l * -w; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -25.5], N[(l * (-w)), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -25.5:\\
\;\;\;\;\ell \cdot \left(-w\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -25.5Initial 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-unprod53.2%
sqr-neg53.2%
sqrt-unprod53.2%
add-sqr-sqrt53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
add-sqr-sqrt53.2%
sqrt-unprod53.2%
sqr-neg53.2%
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 26.0%
mul-1-neg26.0%
unsub-neg26.0%
Simplified26.0%
Taylor expanded in w around inf 26.0%
associate-*r*26.0%
neg-mul-126.0%
*-commutative26.0%
Simplified26.0%
if -25.5 < w Initial program 99.0%
Taylor expanded in w around 0 78.9%
Final simplification63.0%
(FPCore (w l) :precision binary64 (- l (* l w)))
double code(double w, double l) {
return l - (l * w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l - (l * w)
end function
public static double code(double w, double l) {
return l - (l * w);
}
def code(w, l): return l - (l * w)
function code(w, l) return Float64(l - Float64(l * w)) end
function tmp = code(w, l) tmp = l - (l * w); end
code[w_, l_] := N[(l - N[(l * w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell - \ell \cdot 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-sqrt43.3%
sqrt-unprod84.6%
sqr-neg84.6%
sqrt-unprod41.3%
add-sqr-sqrt84.2%
add-sqr-sqrt84.2%
sqrt-unprod84.2%
add-sqr-sqrt41.3%
sqrt-unprod70.5%
sqr-neg70.5%
sqrt-unprod29.2%
add-sqr-sqrt54.5%
pow154.5%
exp-neg54.5%
inv-pow54.5%
pow-prod-up98.3%
metadata-eval98.3%
metadata-eval98.3%
metadata-eval98.3%
Applied egg-rr98.3%
Taylor expanded in w around 0 62.7%
mul-1-neg62.7%
unsub-neg62.7%
Simplified62.7%
(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 56.3%
herbie shell --seed 2024110
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))