
(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 15 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.7%
(FPCore (w l) :precision binary64 (let* ((t_0 (exp (- w))) (t_1 (* t_0 (pow l (exp w))))) (if (<= t_1 0.0) 0.0 (if (<= t_1 5e+305) (fma (fma (log l) l l) w l) t_0))))
double code(double w, double l) {
double t_0 = exp(-w);
double t_1 = t_0 * pow(l, exp(w));
double tmp;
if (t_1 <= 0.0) {
tmp = 0.0;
} else if (t_1 <= 5e+305) {
tmp = fma(fma(log(l), l, l), w, l);
} else {
tmp = t_0;
}
return tmp;
}
function code(w, l) t_0 = exp(Float64(-w)) t_1 = Float64(t_0 * (l ^ exp(w))) tmp = 0.0 if (t_1 <= 0.0) tmp = 0.0; elseif (t_1 <= 5e+305) tmp = fma(fma(log(l), l, l), w, l); else tmp = t_0; end return tmp end
code[w_, l_] := Block[{t$95$0 = N[Exp[(-w)], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], 0.0, If[LessEqual[t$95$1, 5e+305], N[(N[(N[Log[l], $MachinePrecision] * l + l), $MachinePrecision] * w + l), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-w}\\
t_1 := t\_0 \cdot {\ell}^{\left(e^{w}\right)}\\
\mathbf{if}\;t\_1 \leq 0:\\
\;\;\;\;0\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\log \ell, \ell, \ell\right), w, \ell\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 0.0Initial program 100.0%
Applied rewrites100.0%
if 0.0 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.00000000000000009e305Initial program 99.5%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower-log.f64N/A
mul-1-negN/A
lower-neg.f6497.4
Applied rewrites97.4%
Applied rewrites96.9%
if 5.00000000000000009e305 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 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-eval98.7
Applied rewrites98.7%
Final simplification97.8%
(FPCore (w l)
:precision binary64
(let* ((t_0 (exp (- w))))
(if (<= (* t_0 (pow l (exp w))) 4e+307)
(* (- 1.0 w) (pow l (fma (fma 0.5 w 1.0) w 1.0)))
t_0)))
double code(double w, double l) {
double t_0 = exp(-w);
double tmp;
if ((t_0 * pow(l, exp(w))) <= 4e+307) {
tmp = (1.0 - w) * pow(l, fma(fma(0.5, w, 1.0), w, 1.0));
} else {
tmp = t_0;
}
return tmp;
}
function code(w, l) t_0 = exp(Float64(-w)) tmp = 0.0 if (Float64(t_0 * (l ^ exp(w))) <= 4e+307) tmp = Float64(Float64(1.0 - w) * (l ^ fma(fma(0.5, w, 1.0), w, 1.0))); else tmp = t_0; end return tmp end
code[w_, l_] := Block[{t$95$0 = N[Exp[(-w)], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e+307], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(N[(0.5 * w + 1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-w}\\
\mathbf{if}\;t\_0 \cdot {\ell}^{\left(e^{w}\right)} \leq 4 \cdot 10^{+307}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, 1\right), w, 1\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 3.99999999999999994e307Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.8
Applied rewrites98.8%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.8
Applied rewrites98.8%
if 3.99999999999999994e307 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 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-eval100.0
Applied rewrites100.0%
Final simplification99.1%
(FPCore (w l)
:precision binary64
(let* ((t_0 (exp (- w))))
(if (<= (* t_0 (pow l (exp w))) 4e+307)
(* (- 1.0 w) (pow l (+ 1.0 w)))
t_0)))
double code(double w, double l) {
double t_0 = exp(-w);
double tmp;
if ((t_0 * pow(l, exp(w))) <= 4e+307) {
tmp = (1.0 - w) * pow(l, (1.0 + w));
} else {
tmp = 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 = exp(-w)
if ((t_0 * (l ** exp(w))) <= 4d+307) then
tmp = (1.0d0 - w) * (l ** (1.0d0 + w))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = Math.exp(-w);
double tmp;
if ((t_0 * Math.pow(l, Math.exp(w))) <= 4e+307) {
tmp = (1.0 - w) * Math.pow(l, (1.0 + w));
} else {
tmp = t_0;
}
return tmp;
}
def code(w, l): t_0 = math.exp(-w) tmp = 0 if (t_0 * math.pow(l, math.exp(w))) <= 4e+307: tmp = (1.0 - w) * math.pow(l, (1.0 + w)) else: tmp = t_0 return tmp
function code(w, l) t_0 = exp(Float64(-w)) tmp = 0.0 if (Float64(t_0 * (l ^ exp(w))) <= 4e+307) tmp = Float64(Float64(1.0 - w) * (l ^ Float64(1.0 + w))); else tmp = t_0; end return tmp end
function tmp_2 = code(w, l) t_0 = exp(-w); tmp = 0.0; if ((t_0 * (l ^ exp(w))) <= 4e+307) tmp = (1.0 - w) * (l ^ (1.0 + w)); else tmp = t_0; end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[Exp[(-w)], $MachinePrecision]}, If[LessEqual[N[(t$95$0 * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 4e+307], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-w}\\
\mathbf{if}\;t\_0 \cdot {\ell}^{\left(e^{w}\right)} \leq 4 \cdot 10^{+307}:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(1 + w\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 3.99999999999999994e307Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.8
Applied rewrites98.8%
Taylor expanded in w around 0
lower-+.f6498.5
Applied rewrites98.5%
if 3.99999999999999994e307 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 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-eval100.0
Applied rewrites100.0%
Final simplification98.9%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-157) 0.0 (fma (fma (fma -0.16666666666666666 w 0.5) w -1.0) w 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = fma(fma(fma(-0.16666666666666666, w, 0.5), w, -1.0), w, 1.0); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-157], 0.0, N[(N[(N[(-0.16666666666666666 * w + 0.5), $MachinePrecision] * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\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 (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.0000000000000002e-157Initial program 99.9%
Applied rewrites51.3%
if 5.0000000000000002e-157 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites28.7%
Final simplification34.3%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-157) 0.0 (fma (* (fma -0.16666666666666666 w 0.5) w) w 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = fma((fma(-0.16666666666666666, w, 0.5) * w), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = fma(Float64(fma(-0.16666666666666666, w, 0.5) * w), w, 1.0); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-157], 0.0, N[(N[(N[(-0.16666666666666666 * w + 0.5), $MachinePrecision] * w), $MachinePrecision] * w + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right) \cdot w, w, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.0000000000000002e-157Initial program 99.9%
Applied rewrites51.3%
if 5.0000000000000002e-157 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites28.7%
Taylor expanded in w around inf
Applied rewrites28.7%
Final simplification34.3%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-157) 0.0 (fma (* (* w w) -0.16666666666666666) w 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = fma(((w * w) * -0.16666666666666666), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = fma(Float64(Float64(w * w) * -0.16666666666666666), w, 1.0); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-157], 0.0, N[(N[(N[(w * w), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * w + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.0000000000000002e-157Initial program 99.9%
Applied rewrites51.3%
if 5.0000000000000002e-157 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites28.7%
Taylor expanded in w around inf
Applied rewrites28.7%
Final simplification34.3%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 2e-240) 0.0 (* (fma -0.16666666666666666 w 0.5) (* w w))))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 2e-240) {
tmp = 0.0;
} else {
tmp = fma(-0.16666666666666666, w, 0.5) * (w * w);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 2e-240) tmp = 0.0; else tmp = Float64(fma(-0.16666666666666666, w, 0.5) * Float64(w * w)); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-240], 0.0, N[(N[(-0.16666666666666666 * w + 0.5), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 2 \cdot 10^{-240}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right) \cdot \left(w \cdot w\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 1.9999999999999999e-240Initial program 100.0%
Applied rewrites72.6%
if 1.9999999999999999e-240 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval37.1
Applied rewrites37.1%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites26.4%
Taylor expanded in w around inf
Applied rewrites25.2%
Final simplification33.2%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-157) 0.0 (fma (fma 0.5 w -1.0) w 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = fma(fma(0.5, w, -1.0), w, 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = fma(fma(0.5, w, -1.0), w, 1.0); end return tmp end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-157], 0.0, N[(N[(0.5 * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.0000000000000002e-157Initial program 99.9%
Applied rewrites51.3%
if 5.0000000000000002e-157 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f6421.0
Applied rewrites21.0%
Final simplification28.4%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-157) 0.0 (- 1.0 w)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = 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 ((exp(-w) * (l ** exp(w))) <= 5d-157) then
tmp = 0.0d0
else
tmp = 1.0d0 - w
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((Math.exp(-w) * Math.pow(l, Math.exp(w))) <= 5e-157) {
tmp = 0.0;
} else {
tmp = 1.0 - w;
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp(-w) * math.pow(l, math.exp(w))) <= 5e-157: tmp = 0.0 else: tmp = 1.0 - w return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = Float64(1.0 - w); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp(-w) * (l ^ exp(w))) <= 5e-157) tmp = 0.0; else tmp = 1.0 - w; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 5e-157], 0.0, N[(1.0 - w), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-157}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 - w\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 5.0000000000000002e-157Initial program 99.9%
Applied rewrites51.3%
if 5.0000000000000002e-157 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f645.6
Applied rewrites5.6%
Final simplification16.9%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1.12e-154) 0.0 1.0))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1.12e-154) {
tmp = 0.0;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if ((exp(-w) * (l ** exp(w))) <= 1.12d-154) then
tmp = 0.0d0
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if ((Math.exp(-w) * Math.pow(l, Math.exp(w))) <= 1.12e-154) {
tmp = 0.0;
} else {
tmp = 1.0;
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp(-w) * math.pow(l, math.exp(w))) <= 1.12e-154: tmp = 0.0 else: tmp = 1.0 return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 1.12e-154) tmp = 0.0; else tmp = 1.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp(-w) * (l ^ exp(w))) <= 1.12e-154) tmp = 0.0; else tmp = 1.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.12e-154], 0.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 1.12 \cdot 10^{-154}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 1.12e-154Initial program 99.9%
Applied rewrites51.3%
if 1.12e-154 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.7%
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-eval40.5
Applied rewrites40.5%
Taylor expanded in w around 0
Applied rewrites4.9%
Final simplification16.3%
(FPCore (w l)
:precision binary64
(if (<= l 9.6e-6)
(*
(- 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 <= 9.6e-6) {
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 <= 9.6e-6) 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, 9.6e-6], 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 9.6 \cdot 10^{-6}:\\
\;\;\;\;\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 < 9.5999999999999996e-6Initial program 99.9%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6476.9
Applied rewrites76.9%
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.f6499.3
Applied rewrites99.3%
if 9.5999999999999996e-6 < l Initial program 99.6%
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.f6488.2
Applied rewrites88.2%
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.f6467.7
Applied rewrites67.7%
Taylor expanded in w around 0
Applied rewrites67.7%
Taylor expanded in w around 0
Applied rewrites99.2%
(FPCore (w l)
:precision binary64
(if (<= l 1.1e-20)
(*
(- 1.0 w)
(pow l (fma (fma (fma 0.16666666666666666 w 0.5) w 1.0) w 1.0)))
(* (- 1.0 w) (pow l (fma (fma 0.5 w 1.0) w 1.0)))))
double code(double w, double l) {
double tmp;
if (l <= 1.1e-20) {
tmp = (1.0 - w) * pow(l, fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0));
} 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 (l <= 1.1e-20) tmp = Float64(Float64(1.0 - w) * (l ^ fma(fma(fma(0.16666666666666666, w, 0.5), w, 1.0), w, 1.0))); 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[l, 1.1e-20], 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[(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}\;\ell \leq 1.1 \cdot 10^{-20}:\\
\;\;\;\;\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}:\\
\;\;\;\;\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 l < 1.09999999999999995e-20Initial program 99.9%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6476.1
Applied rewrites76.1%
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.f6499.2
Applied rewrites99.2%
if 1.09999999999999995e-20 < l Initial program 99.6%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6469.6
Applied rewrites69.6%
Taylor expanded in w around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.1
Applied rewrites99.1%
(FPCore (w l) :precision binary64 (exp (- w)))
double code(double w, double l) {
return exp(-w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = exp(-w)
end function
public static double code(double w, double l) {
return Math.exp(-w);
}
def code(w, l): return math.exp(-w)
function code(w, l) return exp(Float64(-w)) end
function tmp = code(w, l) tmp = exp(-w); end
code[w_, l_] := N[Exp[(-w)], $MachinePrecision]
\begin{array}{l}
\\
e^{-w}
\end{array}
Initial program 99.7%
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.8
Applied rewrites42.8%
Final simplification42.8%
(FPCore (w l) :precision binary64 0.0)
double code(double w, double l) {
return 0.0;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = 0.0d0
end function
public static double code(double w, double l) {
return 0.0;
}
def code(w, l): return 0.0
function code(w, l) return 0.0 end
function tmp = code(w, l) tmp = 0.0; end
code[w_, l_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 99.7%
Applied rewrites14.4%
herbie shell --seed 2024323
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))