
(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 16 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 (* (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.6%
(FPCore (w l)
:precision binary64
(if (<= w -4.6e-11)
(exp (fma (log l) (exp w) (- w)))
(/
(pow l (exp w))
(fma (fma (fma 0.16666666666666666 w 0.5) w 1.0) w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -4.6e-11) {
tmp = exp(fma(log(l), exp(w), -w));
} else {
tmp = pow(l, exp(w)) / fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -4.6e-11) tmp = exp(fma(log(l), exp(w), Float64(-w))); else tmp = Float64((l ^ exp(w)) / fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0)); end return tmp end
code[w_, l_] := If[LessEqual[w, -4.6e-11], N[Exp[N[(N[Log[l], $MachinePrecision] * N[Exp[w], $MachinePrecision] + (-w)), $MachinePrecision]], $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(N[(N[(0.16666666666666666 * w + 0.5), $MachinePrecision] * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.6 \cdot 10^{-11}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \ell, e^{w}, -w\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(e^{w}\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, w, 0.5\right), w, 1\right), w, 1\right)}\\
\end{array}
\end{array}
if w < -4.60000000000000027e-11Initial program 99.5%
Taylor expanded in w around inf
*-commutativeN/A
exp-to-powN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
*-commutativeN/A
mul-1-negN/A
+-rgt-identityN/A
exp-sumN/A
sub-negN/A
+-rgt-identityN/A
div-expN/A
lower-/.f64N/A
Applied rewrites99.5%
Applied rewrites99.5%
if -4.60000000000000027e-11 < w Initial program 99.7%
Taylor expanded in w around inf
*-commutativeN/A
exp-to-powN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
*-commutativeN/A
mul-1-negN/A
+-rgt-identityN/A
exp-sumN/A
sub-negN/A
+-rgt-identityN/A
div-expN/A
lower-/.f64N/A
Applied rewrites99.7%
Taylor expanded in w around 0
Applied rewrites99.6%
(FPCore (w l)
:precision binary64
(if (<= w -1.6)
(exp (- w))
(/
(pow l (exp w))
(fma (fma (fma 0.16666666666666666 w 0.5) w 1.0) w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -1.6) {
tmp = exp(-w);
} else {
tmp = pow(l, exp(w)) / fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.6) tmp = exp(Float64(-w)); else tmp = Float64((l ^ exp(w)) / fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0)); end return tmp end
code[w_, l_] := If[LessEqual[w, -1.6], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(N[(N[(0.16666666666666666 * w + 0.5), $MachinePrecision] * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.6:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(e^{w}\right)}}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, w, 0.5\right), w, 1\right), w, 1\right)}\\
\end{array}
\end{array}
if w < -1.6000000000000001Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6498.6
Applied rewrites98.6%
if -1.6000000000000001 < w Initial program 99.5%
Taylor expanded in w around inf
*-commutativeN/A
exp-to-powN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
*-commutativeN/A
mul-1-negN/A
+-rgt-identityN/A
exp-sumN/A
sub-negN/A
+-rgt-identityN/A
div-expN/A
lower-/.f64N/A
Applied rewrites99.5%
Taylor expanded in w around 0
Applied rewrites99.1%
(FPCore (w l) :precision binary64 (if (<= w -4.2) (exp (- w)) (* (- 1.0 w) (pow l (exp w)))))
double code(double w, double l) {
double tmp;
if (w <= -4.2) {
tmp = exp(-w);
} else {
tmp = (1.0 - w) * pow(l, exp(w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-4.2d0)) then
tmp = exp(-w)
else
tmp = (1.0d0 - w) * (l ** exp(w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -4.2) {
tmp = Math.exp(-w);
} else {
tmp = (1.0 - w) * Math.pow(l, Math.exp(w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -4.2: tmp = math.exp(-w) else: tmp = (1.0 - w) * math.pow(l, math.exp(w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -4.2) tmp = exp(Float64(-w)); else tmp = Float64(Float64(1.0 - w) * (l ^ exp(w))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -4.2) tmp = exp(-w); else tmp = (1.0 - w) * (l ^ exp(w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -4.2], N[Exp[(-w)], $MachinePrecision], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -4.2:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(e^{w}\right)}\\
\end{array}
\end{array}
if w < -4.20000000000000018Initial program 100.0%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval100.0
Applied rewrites100.0%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f64100.0
Applied rewrites100.0%
if -4.20000000000000018 < w Initial program 99.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.0
Applied rewrites98.0%
Final simplification98.5%
(FPCore (w l) :precision binary64 (if (or (<= w -0.72) (not (<= w 560.0))) (exp (- w)) (pow (pow l -1.0) -1.0)))
double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 560.0)) {
tmp = exp(-w);
} else {
tmp = pow(pow(l, -1.0), -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.72d0)) .or. (.not. (w <= 560.0d0))) then
tmp = exp(-w)
else
tmp = (l ** (-1.0d0)) ** (-1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 560.0)) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(Math.pow(l, -1.0), -1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.72) or not (w <= 560.0): tmp = math.exp(-w) else: tmp = math.pow(math.pow(l, -1.0), -1.0) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.72) || !(w <= 560.0)) tmp = exp(Float64(-w)); else tmp = (l ^ -1.0) ^ -1.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.72) || ~((w <= 560.0))) tmp = exp(-w); else tmp = (l ^ -1.0) ^ -1.0; end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.72], N[Not[LessEqual[w, 560.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[Power[N[Power[l, -1.0], $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.72 \lor \neg \left(w \leq 560\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;{\left({\ell}^{-1}\right)}^{-1}\\
\end{array}
\end{array}
if w < -0.71999999999999997 or 560 < w Initial program 100.0%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval99.1
Applied rewrites99.1%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6499.1
Applied rewrites99.1%
if -0.71999999999999997 < w < 560Initial program 99.4%
Taylor expanded in w around inf
*-commutativeN/A
exp-to-powN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
*-commutativeN/A
mul-1-negN/A
+-rgt-identityN/A
exp-sumN/A
sub-negN/A
+-rgt-identityN/A
div-expN/A
lower-/.f64N/A
Applied rewrites99.4%
Applied rewrites99.2%
Taylor expanded in w around 0
Applied rewrites96.4%
Final simplification97.4%
(FPCore (w l) :precision binary64 (if (<= w -1.06e+56) (fma (fma (fma -0.16666666666666666 w 0.5) w -1.0) w 1.0) (pow (pow l -1.0) -1.0)))
double code(double w, double l) {
double tmp;
if (w <= -1.06e+56) {
tmp = fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0);
} else {
tmp = pow(pow(l, -1.0), -1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.06e+56) tmp = fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0); else tmp = (l ^ -1.0) ^ -1.0; end return tmp end
code[w_, l_] := If[LessEqual[w, -1.06e+56], N[(N[(N[(-0.16666666666666666 * w + 0.5), $MachinePrecision] * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision], N[Power[N[Power[l, -1.0], $MachinePrecision], -1.0], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.06 \cdot 10^{+56}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{\left({\ell}^{-1}\right)}^{-1}\\
\end{array}
\end{array}
if w < -1.06e56Initial program 100.0%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval100.0
Applied rewrites100.0%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6487.4
Applied rewrites87.4%
if -1.06e56 < w Initial program 99.5%
Taylor expanded in w around inf
*-commutativeN/A
exp-to-powN/A
remove-double-negN/A
distribute-lft-neg-outN/A
log-recN/A
*-commutativeN/A
mul-1-negN/A
+-rgt-identityN/A
exp-sumN/A
sub-negN/A
+-rgt-identityN/A
div-expN/A
lower-/.f64N/A
Applied rewrites99.5%
Applied rewrites99.4%
Taylor expanded in w around 0
Applied rewrites75.0%
Final simplification77.5%
(FPCore (w l)
:precision binary64
(if (<= l 1.85e-17)
(*
(- 1.0 w)
(pow l (fma (fma (fma 0.16666666666666666 w 0.5) w 1.0) w 1.0)))
(* (fma (fma 0.5 w -1.0) w 1.0) (pow l (fma (fma 0.5 w 1.0) w 1.0)))))
double code(double w, double l) {
double tmp;
if (l <= 1.85e-17) {
tmp = (1.0 - w) * pow(l, fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0));
} else {
tmp = fma(fma(0.5, w, -1.0), w, 1.0) * pow(l, fma(fma(0.5, w, 1.0), w, 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (l <= 1.85e-17) tmp = Float64(Float64(1.0 - w) * (l ^ fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0))); else tmp = Float64(fma(fma(0.5, w, -1.0), w, 1.0) * (l ^ fma(fma(0.5, w, 1.0), w, 1.0))); end return tmp end
code[w_, l_] := If[LessEqual[l, 1.85e-17], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(N[(N[(0.16666666666666666 * w + 0.5), $MachinePrecision] * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision] * N[Power[l, N[(N[(0.5 * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.85 \cdot 10^{-17}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, w, 0.5\right), w, 1\right), w, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, 1\right), w, 1\right)\right)}\\
\end{array}
\end{array}
if l < 1.8499999999999999e-17Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6477.3
Applied rewrites77.3%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.3
Applied rewrites98.3%
if 1.8499999999999999e-17 < l Initial program 99.6%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6484.0
Applied rewrites84.0%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.7
Applied rewrites98.7%
Final simplification98.5%
(FPCore (w l)
:precision binary64
(if (<= w -1.55)
(exp (- w))
(*
(- 1.0 w)
(pow l (fma (fma (fma 0.16666666666666666 w 0.5) w 1.0) w 1.0)))))
double code(double w, double l) {
double tmp;
if (w <= -1.55) {
tmp = exp(-w);
} else {
tmp = (1.0 - w) * pow(l, fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.55) tmp = exp(Float64(-w)); else tmp = Float64(Float64(1.0 - w) * (l ^ fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0))); end return tmp end
code[w_, l_] := If[LessEqual[w, -1.55], N[Exp[(-w)], $MachinePrecision], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(N[(N[(0.16666666666666666 * w + 0.5), $MachinePrecision] * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.55:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, w, 0.5\right), w, 1\right), w, 1\right)\right)}\\
\end{array}
\end{array}
if w < -1.55000000000000004Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6498.6
Applied rewrites98.6%
if -1.55000000000000004 < w Initial program 99.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.4
Applied rewrites98.4%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.4
Applied rewrites98.4%
Final simplification98.5%
(FPCore (w l) :precision binary64 (if (<= w -1.3) (exp (- w)) (* (- 1.0 w) (pow l (fma (fma 0.5 w 1.0) w 1.0)))))
double code(double w, double l) {
double tmp;
if (w <= -1.3) {
tmp = exp(-w);
} else {
tmp = (1.0 - w) * pow(l, fma(fma(0.5, w, 1.0), w, 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -1.3) tmp = exp(Float64(-w)); else tmp = Float64(Float64(1.0 - w) * (l ^ fma(fma(0.5, w, 1.0), w, 1.0))); end return tmp end
code[w_, l_] := If[LessEqual[w, -1.3], N[Exp[(-w)], $MachinePrecision], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(N[(0.5 * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.3:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, 1\right), w, 1\right)\right)}\\
\end{array}
\end{array}
if w < -1.30000000000000004Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6498.6
Applied rewrites98.6%
if -1.30000000000000004 < w Initial program 99.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.4
Applied rewrites98.4%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.4
Applied rewrites98.4%
Final simplification98.4%
(FPCore (w l) :precision binary64 (if (or (<= w -0.72) (not (<= w 560.0))) (exp (- w)) (* 1.0 (pow l 1.0))))
double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 560.0)) {
tmp = exp(-w);
} else {
tmp = 1.0 * pow(l, 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.72d0)) .or. (.not. (w <= 560.0d0))) then
tmp = exp(-w)
else
tmp = 1.0d0 * (l ** 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((w <= -0.72) || !(w <= 560.0)) {
tmp = Math.exp(-w);
} else {
tmp = 1.0 * Math.pow(l, 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.72) or not (w <= 560.0): tmp = math.exp(-w) else: tmp = 1.0 * math.pow(l, 1.0) return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.72) || !(w <= 560.0)) tmp = exp(Float64(-w)); else tmp = Float64(1.0 * (l ^ 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((w <= -0.72) || ~((w <= 560.0))) tmp = exp(-w); else tmp = 1.0 * (l ^ 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[Or[LessEqual[w, -0.72], N[Not[LessEqual[w, 560.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], N[(1.0 * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.72 \lor \neg \left(w \leq 560\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot {\ell}^{1}\\
\end{array}
\end{array}
if w < -0.71999999999999997 or 560 < w Initial program 100.0%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval99.1
Applied rewrites99.1%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6499.1
Applied rewrites99.1%
if -0.71999999999999997 < w < 560Initial program 99.4%
Taylor expanded in w around 0
Applied rewrites97.3%
Taylor expanded in w around 0
Applied rewrites96.6%
Final simplification97.6%
(FPCore (w l) :precision binary64 (if (<= w -1.0) (exp (- w)) (* (- 1.0 w) (pow l (+ 1.0 w)))))
double code(double w, double l) {
double tmp;
if (w <= -1.0) {
tmp = exp(-w);
} else {
tmp = (1.0 - w) * pow(l, (1.0 + w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-1.0d0)) then
tmp = exp(-w)
else
tmp = (1.0d0 - w) * (l ** (1.0d0 + w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.0) {
tmp = Math.exp(-w);
} else {
tmp = (1.0 - w) * Math.pow(l, (1.0 + w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.0: tmp = math.exp(-w) else: tmp = (1.0 - w) * math.pow(l, (1.0 + w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.0) tmp = exp(Float64(-w)); else tmp = Float64(Float64(1.0 - w) * (l ^ Float64(1.0 + w))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.0) tmp = exp(-w); else tmp = (1.0 - w) * (l ^ (1.0 + w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.0], N[Exp[(-w)], $MachinePrecision], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(1 + w\right)}\\
\end{array}
\end{array}
if w < -1Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6498.6
Applied rewrites98.6%
if -1 < w Initial program 99.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.4
Applied rewrites98.4%
Taylor expanded in w around 0
lower-+.f6498.1
Applied rewrites98.1%
Final simplification98.2%
(FPCore (w l) :precision binary64 (if (<= w -1.05) (exp (- w)) (* 1.0 (pow l (+ 1.0 w)))))
double code(double w, double l) {
double tmp;
if (w <= -1.05) {
tmp = exp(-w);
} else {
tmp = 1.0 * pow(l, (1.0 + w));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-1.05d0)) then
tmp = exp(-w)
else
tmp = 1.0d0 * (l ** (1.0d0 + w))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.05) {
tmp = Math.exp(-w);
} else {
tmp = 1.0 * Math.pow(l, (1.0 + w));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.05: tmp = math.exp(-w) else: tmp = 1.0 * math.pow(l, (1.0 + w)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.05) tmp = exp(Float64(-w)); else tmp = Float64(1.0 * (l ^ Float64(1.0 + w))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.05) tmp = exp(-w); else tmp = 1.0 * (l ^ (1.0 + w)); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.05], N[Exp[(-w)], $MachinePrecision], N[(1.0 * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.05:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;1 \cdot {\ell}^{\left(1 + w\right)}\\
\end{array}
\end{array}
if w < -1.05000000000000004Initial program 99.9%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval98.6
Applied rewrites98.6%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6498.6
Applied rewrites98.6%
if -1.05000000000000004 < w Initial program 99.5%
Taylor expanded in w around 0
Applied rewrites97.8%
Taylor expanded in w around 0
lower-+.f6497.7
Applied rewrites97.7%
Final simplification97.9%
(FPCore (w l) :precision binary64 (fma (fma (fma -0.16666666666666666 w 0.5) w -1.0) w 1.0))
double code(double w, double l) {
return fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0);
}
function code(w, l) return fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0) end
code[w_, l_] := N[(N[(N[(-0.16666666666666666 * w + 0.5), $MachinePrecision] * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)
\end{array}
Initial program 99.6%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval42.1
Applied rewrites42.1%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6421.6
Applied rewrites21.6%
(FPCore (w l) :precision binary64 (fma (fma 0.5 w -1.0) w 1.0))
double code(double w, double l) {
return fma(fma(0.5, w, -1.0), w, 1.0);
}
function code(w, l) return fma(fma(0.5, w, -1.0), w, 1.0) end
code[w_, l_] := N[(N[(0.5 * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right)
\end{array}
Initial program 99.6%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval42.1
Applied rewrites42.1%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6417.6
Applied rewrites17.6%
(FPCore (w l) :precision binary64 (- 1.0 w))
double code(double w, double l) {
return 1.0 - w;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = 1.0d0 - w
end function
public static double code(double w, double l) {
return 1.0 - w;
}
def code(w, l): return 1.0 - w
function code(w, l) return Float64(1.0 - w) end
function tmp = code(w, l) tmp = 1.0 - w; end
code[w_, l_] := N[(1.0 - w), $MachinePrecision]
\begin{array}{l}
\\
1 - w
\end{array}
Initial program 99.6%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval42.1
Applied rewrites42.1%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f645.3
Applied rewrites5.3%
(FPCore (w l) :precision binary64 1.0)
double code(double w, double l) {
return 1.0;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = 1.0d0
end function
public static double code(double w, double l) {
return 1.0;
}
def code(w, l): return 1.0
function code(w, l) return 1.0 end
function tmp = code(w, l) tmp = 1.0; end
code[w_, l_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 99.6%
lift-pow.f64N/A
sqr-powN/A
pow-prod-upN/A
flip-+N/A
+-inversesN/A
metadata-evalN/A
metadata-evalN/A
metadata-evalN/A
+-inversesN/A
metadata-evalN/A
flip--N/A
metadata-evalN/A
metadata-eval42.1
Applied rewrites42.1%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f645.3
Applied rewrites5.3%
Taylor expanded in w around inf
Applied rewrites4.3%
Taylor expanded in w around 0
Applied rewrites4.6%
herbie shell --seed 2024296
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))