
(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
(if (<= w -1.6)
(exp (- w))
(/
(pow l (exp w))
(+ 1.0 (* w (+ 1.0 (* w (+ 0.5 (* w 0.16666666666666666)))))))))
double code(double w, double l) {
double tmp;
if (w <= -1.6) {
tmp = exp(-w);
} else {
tmp = pow(l, exp(w)) / (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 <= (-1.6d0)) then
tmp = exp(-w)
else
tmp = (l ** exp(w)) / (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 <= -1.6) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, Math.exp(w)) / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.6: tmp = math.exp(-w) else: tmp = math.pow(l, math.exp(w)) / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.6) tmp = exp(Float64(-w)); else tmp = Float64((l ^ exp(w)) / 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 <= -1.6) tmp = exp(-w); else tmp = (l ^ exp(w)) / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666)))))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.6], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / 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 -1.6:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(e^{w}\right)}}{1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)}\\
\end{array}
\end{array}
if w < -1.6000000000000001Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -1.6000000000000001 < w Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 99.2%
*-commutative99.2%
Simplified99.2%
(FPCore (w l) :precision binary64 (let* ((t_0 (pow (sqrt (cbrt (exp w))) 3.0))) (/ (pow l (exp w)) (* t_0 t_0))))
double code(double w, double l) {
double t_0 = pow(sqrt(cbrt(exp(w))), 3.0);
return pow(l, exp(w)) / (t_0 * t_0);
}
public static double code(double w, double l) {
double t_0 = Math.pow(Math.sqrt(Math.cbrt(Math.exp(w))), 3.0);
return Math.pow(l, Math.exp(w)) / (t_0 * t_0);
}
function code(w, l) t_0 = sqrt(cbrt(exp(w))) ^ 3.0 return Float64((l ^ exp(w)) / Float64(t_0 * t_0)) end
code[w_, l_] := Block[{t$95$0 = N[Power[N[Sqrt[N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision]}, N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(\sqrt{\sqrt[3]{e^{w}}}\right)}^{3}\\
\frac{{\ell}^{\left(e^{w}\right)}}{t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
add-cube-cbrt99.2%
pow399.2%
add-sqr-sqrt99.2%
unpow-prod-down99.2%
Applied egg-rr99.2%
(FPCore (w l) :precision binary64 (let* ((t_0 (cbrt (exp w)))) (/ (pow l (exp w)) (* t_0 (pow (pow (cbrt t_0) 2.0) 3.0)))))
double code(double w, double l) {
double t_0 = cbrt(exp(w));
return pow(l, exp(w)) / (t_0 * pow(pow(cbrt(t_0), 2.0), 3.0));
}
public static double code(double w, double l) {
double t_0 = Math.cbrt(Math.exp(w));
return Math.pow(l, Math.exp(w)) / (t_0 * Math.pow(Math.pow(Math.cbrt(t_0), 2.0), 3.0));
}
function code(w, l) t_0 = cbrt(exp(w)) return Float64((l ^ exp(w)) / Float64(t_0 * ((cbrt(t_0) ^ 2.0) ^ 3.0))) end
code[w_, l_] := Block[{t$95$0 = N[Power[N[Exp[w], $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(t$95$0 * N[Power[N[Power[N[Power[t$95$0, 1/3], $MachinePrecision], 2.0], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{e^{w}}\\
\frac{{\ell}^{\left(e^{w}\right)}}{t\_0 \cdot {\left({\left(\sqrt[3]{t\_0}\right)}^{2}\right)}^{3}}
\end{array}
\end{array}
Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
add-cube-cbrt99.2%
pow399.2%
add-cube-cbrt99.2%
unpow-prod-down99.2%
pow299.2%
pow399.2%
add-cube-cbrt99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (w l) :precision binary64 (/ (pow l (exp w)) (cbrt (exp (* w 3.0)))))
double code(double w, double l) {
return pow(l, exp(w)) / cbrt(exp((w * 3.0)));
}
public static double code(double w, double l) {
return Math.pow(l, Math.exp(w)) / Math.cbrt(Math.exp((w * 3.0)));
}
function code(w, l) return Float64((l ^ exp(w)) / cbrt(exp(Float64(w * 3.0)))) end
code[w_, l_] := N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[Power[N[Exp[N[(w * 3.0), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{\left(e^{w}\right)}}{\sqrt[3]{e^{w \cdot 3}}}
\end{array}
Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
add-cbrt-cube99.2%
add-exp-log99.2%
pow399.2%
log-pow99.2%
add-log-exp99.2%
Applied egg-rr99.2%
Final simplification99.2%
(FPCore (w l) :precision binary64 (/ (pow l (exp w)) (+ (+ (exp w) 1.0) -1.0)))
double code(double w, double l) {
return pow(l, exp(w)) / ((exp(w) + 1.0) + -1.0);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = (l ** exp(w)) / ((exp(w) + 1.0d0) + (-1.0d0))
end function
public static double code(double w, double l) {
return Math.pow(l, Math.exp(w)) / ((Math.exp(w) + 1.0) + -1.0);
}
def code(w, l): return math.pow(l, math.exp(w)) / ((math.exp(w) + 1.0) + -1.0)
function code(w, l) return Float64((l ^ exp(w)) / Float64(Float64(exp(w) + 1.0) + -1.0)) end
function tmp = code(w, l) tmp = (l ^ exp(w)) / ((exp(w) + 1.0) + -1.0); end
code[w_, l_] := N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(N[(N[Exp[w], $MachinePrecision] + 1.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{\left(e^{w}\right)}}{\left(e^{w} + 1\right) + -1}
\end{array}
Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
expm1-log1p-u99.2%
expm1-undefine99.2%
log1p-undefine99.2%
rem-exp-log99.2%
Applied egg-rr99.2%
Final simplification99.2%
(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.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
(FPCore (w l) :precision binary64 (if (<= w -3.6) (exp (- w)) (/ (pow l (exp w)) (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= -3.6) {
tmp = exp(-w);
} else {
tmp = pow(l, exp(w)) / (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 <= (-3.6d0)) then
tmp = exp(-w)
else
tmp = (l ** exp(w)) / (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 <= -3.6) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, Math.exp(w)) / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -3.6: tmp = math.exp(-w) else: tmp = math.pow(l, math.exp(w)) / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= -3.6) tmp = exp(Float64(-w)); else tmp = Float64((l ^ exp(w)) / 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 <= -3.6) tmp = exp(-w); else tmp = (l ^ exp(w)) / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -3.6], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / 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 -3.6:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(e^{w}\right)}}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < -3.60000000000000009Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -3.60000000000000009 < w Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 99.0%
*-commutative99.0%
Simplified99.0%
(FPCore (w l)
:precision binary64
(if (<= w -4500.0)
(exp (- w))
(/
(pow l (+ 1.0 (* w (+ 1.0 (* w (+ 0.5 (* w 0.16666666666666666)))))))
(+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= -4500.0) {
tmp = exp(-w);
} else {
tmp = pow(l, (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))))) / (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 <= (-4500.0d0)) then
tmp = exp(-w)
else
tmp = (l ** (1.0d0 + (w * (1.0d0 + (w * (0.5d0 + (w * 0.16666666666666666d0))))))) / (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 <= -4500.0) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))))) / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -4500.0: tmp = math.exp(-w) else: tmp = math.pow(l, (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))))) / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= -4500.0) tmp = exp(Float64(-w)); else tmp = Float64((l ^ Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * Float64(0.5 + Float64(w * 0.16666666666666666))))))) / 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 <= -4500.0) tmp = exp(-w); else tmp = (l ^ (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))))) / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -4500.0], N[Exp[(-w)], $MachinePrecision], N[(N[Power[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] / 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 -4500:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)\right)}}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < -4500Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -4500 < w Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in w around 0 99.0%
*-commutative98.6%
Simplified99.0%
(FPCore (w l) :precision binary64 (let* ((t_0 (+ 1.0 (* w (+ 1.0 (* w 0.5)))))) (if (<= w -1.3) (exp (- w)) (/ (pow l t_0) t_0))))
double code(double w, double l) {
double t_0 = 1.0 + (w * (1.0 + (w * 0.5)));
double tmp;
if (w <= -1.3) {
tmp = exp(-w);
} else {
tmp = pow(l, t_0) / t_0;
}
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 = 1.0d0 + (w * (1.0d0 + (w * 0.5d0)))
if (w <= (-1.3d0)) then
tmp = exp(-w)
else
tmp = (l ** t_0) / t_0
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = 1.0 + (w * (1.0 + (w * 0.5)));
double tmp;
if (w <= -1.3) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, t_0) / t_0;
}
return tmp;
}
def code(w, l): t_0 = 1.0 + (w * (1.0 + (w * 0.5))) tmp = 0 if w <= -1.3: tmp = math.exp(-w) else: tmp = math.pow(l, t_0) / t_0 return tmp
function code(w, l) t_0 = Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5)))) tmp = 0.0 if (w <= -1.3) tmp = exp(Float64(-w)); else tmp = Float64((l ^ t_0) / t_0); end return tmp end
function tmp_2 = code(w, l) t_0 = 1.0 + (w * (1.0 + (w * 0.5))); tmp = 0.0; if (w <= -1.3) tmp = exp(-w); else tmp = (l ^ t_0) / t_0; end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -1.3], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, t$95$0], $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + w \cdot \left(1 + w \cdot 0.5\right)\\
\mathbf{if}\;w \leq -1.3:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{t\_0}}{t\_0}\\
\end{array}
\end{array}
if w < -1.30000000000000004Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -1.30000000000000004 < w Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in w around 0 98.8%
*-commutative99.0%
Simplified98.8%
(FPCore (w l) :precision binary64 (if (or (<= w -0.38) (not (<= w 170000.0))) (exp (- w)) (+ l (* w (- (* l (log l)) l)))))
double code(double w, double l) {
double tmp;
if ((w <= -0.38) || !(w <= 170000.0)) {
tmp = exp(-w);
} else {
tmp = l + (w * ((l * log(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 <= (-0.38d0)) .or. (.not. (w <= 170000.0d0))) then
tmp = exp(-w)
else
tmp = l + (w * ((l * log(l)) - l))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.38) || !(w <= 170000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l + (w * ((l * Math.log(l)) - l));
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.38) or not (w <= 170000.0): tmp = math.exp(-w) else: tmp = l + (w * ((l * math.log(l)) - l)) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.38) || !(w <= 170000.0)) tmp = exp(Float64(-w)); else tmp = Float64(l + Float64(w * Float64(Float64(l * log(l)) - l))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.38) || ~((w <= 170000.0))) tmp = exp(-w); else tmp = l + (w * ((l * log(l)) - l)); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.38], N[Not[LessEqual[w, 170000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(l + N[(w * N[(N[(l * N[Log[l], $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.38 \lor \neg \left(w \leq 170000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell + w \cdot \left(\ell \cdot \log \ell - \ell\right)\\
\end{array}
\end{array}
if w < -0.38 or 1.7e5 < 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-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -0.38 < w < 1.7e5Initial program 98.6%
exp-neg98.6%
remove-double-neg98.6%
associate-*l/98.6%
*-lft-identity98.6%
remove-double-neg98.6%
Simplified98.6%
Taylor expanded in w around 0 95.5%
Final simplification97.5%
(FPCore (w l) :precision binary64 (if (<= w -4500.0) (exp (- w)) (/ (pow l (+ w 1.0)) (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
double tmp;
if (w <= -4500.0) {
tmp = exp(-w);
} else {
tmp = pow(l, (w + 1.0)) / (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 <= (-4500.0d0)) then
tmp = exp(-w)
else
tmp = (l ** (w + 1.0d0)) / (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 <= -4500.0) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, (w + 1.0)) / (1.0 + (w * (1.0 + (w * 0.5))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -4500.0: tmp = math.exp(-w) else: tmp = math.pow(l, (w + 1.0)) / (1.0 + (w * (1.0 + (w * 0.5)))) return tmp
function code(w, l) tmp = 0.0 if (w <= -4500.0) tmp = exp(Float64(-w)); else tmp = Float64((l ^ Float64(w + 1.0)) / 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 <= -4500.0) tmp = exp(-w); else tmp = (l ^ (w + 1.0)) / (1.0 + (w * (1.0 + (w * 0.5)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -4500.0], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision] / 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 -4500:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(w + 1\right)}}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\
\end{array}
\end{array}
if w < -4500Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -4500 < w Initial program 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
Taylor expanded in w around 0 98.5%
*-commutative98.5%
Simplified98.5%
Taylor expanded in w around 0 98.2%
+-commutative98.2%
Simplified98.2%
(FPCore (w l) :precision binary64 (if (or (<= w -0.7) (not (<= w 170000.0))) (exp (- w)) l))
double code(double w, double l) {
double tmp;
if ((w <= -0.7) || !(w <= 170000.0)) {
tmp = exp(-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.7d0)) .or. (.not. (w <= 170000.0d0))) then
tmp = exp(-w)
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.7) || !(w <= 170000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.7) or not (w <= 170000.0): tmp = math.exp(-w) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.7) || !(w <= 170000.0)) tmp = exp(Float64(-w)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.7) || ~((w <= 170000.0))) tmp = exp(-w); else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.7], N[Not[LessEqual[w, 170000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7 \lor \neg \left(w \leq 170000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.69999999999999996 or 1.7e5 < 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-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
exp-prod100.0%
log-E100.0%
*-rgt-identity100.0%
exp-prod100.0%
mul-1-neg100.0%
Simplified100.0%
if -0.69999999999999996 < w < 1.7e5Initial program 98.6%
exp-neg98.6%
remove-double-neg98.6%
associate-*l/98.6%
*-lft-identity98.6%
remove-double-neg98.6%
Simplified98.6%
Taylor expanded in w around 0 94.5%
Final simplification96.9%
(FPCore (w l) :precision binary64 (if (<= w -3.6e+55) (+ 1.0 (* w (+ (* w 0.5) -1.0))) l))
double code(double w, double l) {
double tmp;
if (w <= -3.6e+55) {
tmp = 1.0 + (w * ((w * 0.5) + -1.0));
} 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 <= (-3.6d+55)) then
tmp = 1.0d0 + (w * ((w * 0.5d0) + (-1.0d0)))
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -3.6e+55) {
tmp = 1.0 + (w * ((w * 0.5) + -1.0));
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -3.6e+55: tmp = 1.0 + (w * ((w * 0.5) + -1.0)) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -3.6e+55) tmp = Float64(1.0 + Float64(w * Float64(Float64(w * 0.5) + -1.0))); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -3.6e+55) tmp = 1.0 + (w * ((w * 0.5) + -1.0)); else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -3.6e+55], N[(1.0 + N[(w * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -3.6 \cdot 10^{+55}:\\
\;\;\;\;1 + w \cdot \left(w \cdot 0.5 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -3.59999999999999987e55Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
add-exp-log100.0%
pow1100.0%
log-pow100.0%
exp-prod100.0%
exp-1-e100.0%
log-div100.0%
log-pow100.0%
add-log-exp100.0%
fma-neg100.0%
Applied egg-rr100.0%
Taylor expanded in w around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Taylor expanded in w around 0 62.6%
log-E62.6%
metadata-eval62.6%
associate-*r*62.6%
*-commutative62.6%
log-E62.6%
metadata-eval62.6%
*-rgt-identity62.6%
Simplified62.6%
if -3.59999999999999987e55 < w Initial program 99.0%
exp-neg99.0%
remove-double-neg99.0%
associate-*l/99.0%
*-lft-identity99.0%
remove-double-neg99.0%
Simplified99.0%
Taylor expanded in w around 0 69.7%
Final simplification68.1%
(FPCore (w l) :precision binary64 l)
double code(double w, double l) {
return l;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l
end function
public static double code(double w, double l) {
return l;
}
def code(w, l): return l
function code(w, l) return l end
function tmp = code(w, l) tmp = l; end
code[w_, l_] := l
\begin{array}{l}
\\
\ell
\end{array}
Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
Taylor expanded in w around 0 55.6%
herbie shell --seed 2024132
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))