
(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.8%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-163) 0.0 (fma w (fma w (fma w -0.16666666666666666 0.5) -1.0) 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-163) {
tmp = 0.0;
} else {
tmp = fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-163) tmp = 0.0; else tmp = fma(w, fma(w, fma(w, -0.16666666666666666, 0.5), -1.0), 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-163], 0.0, N[(w * N[(w * N[(w * -0.16666666666666666 + 0.5), $MachinePrecision] + -1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-163}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w, \mathsf{fma}\left(w, \mathsf{fma}\left(w, -0.16666666666666666, 0.5\right), -1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 4.99999999999999977e-163Initial program 100.0%
Applied rewrites65.6%
if 4.99999999999999977e-163 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.8%
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-eval47.5
Applied rewrites47.5%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6435.6
Applied rewrites35.6%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-163) 0.0 (fma w (* w 0.5) 1.0)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-163) {
tmp = 0.0;
} else {
tmp = fma(w, (w * 0.5), 1.0);
}
return tmp;
}
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 5e-163) tmp = 0.0; else tmp = fma(w, Float64(w * 0.5), 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-163], 0.0, N[(w * N[(w * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 5 \cdot 10^{-163}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w, w \cdot 0.5, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 4.99999999999999977e-163Initial program 100.0%
Applied rewrites65.6%
if 4.99999999999999977e-163 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.8%
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-eval47.5
Applied rewrites47.5%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6426.9
Applied rewrites26.9%
Taylor expanded in w around inf
Applied rewrites26.9%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 2e-255) 0.0 (* w (* w 0.5))))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 2e-255) {
tmp = 0.0;
} else {
tmp = w * (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 ((exp(-w) * (l ** exp(w))) <= 2d-255) then
tmp = 0.0d0
else
tmp = w * (w * 0.5d0)
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))) <= 2e-255) {
tmp = 0.0;
} else {
tmp = w * (w * 0.5);
}
return tmp;
}
def code(w, l): tmp = 0 if (math.exp(-w) * math.pow(l, math.exp(w))) <= 2e-255: tmp = 0.0 else: tmp = w * (w * 0.5) return tmp
function code(w, l) tmp = 0.0 if (Float64(exp(Float64(-w)) * (l ^ exp(w))) <= 2e-255) tmp = 0.0; else tmp = Float64(w * Float64(w * 0.5)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if ((exp(-w) * (l ^ exp(w))) <= 2e-255) tmp = 0.0; else tmp = w * (w * 0.5); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[N[(N[Exp[(-w)], $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2e-255], 0.0, N[(w * N[(w * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 2 \cdot 10^{-255}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;w \cdot \left(w \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 2e-255Initial program 100.0%
Applied rewrites83.7%
if 2e-255 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.8%
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-eval43.8
Applied rewrites43.8%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6424.9
Applied rewrites24.9%
Taylor expanded in w around inf
Applied rewrites23.9%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 5e-163) 0.0 (- 1.0 w)))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 5e-163) {
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-163) 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-163) {
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-163: 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-163) 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-163) 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-163], 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^{-163}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;1 - w\\
\end{array}
\end{array}
if (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) < 4.99999999999999977e-163Initial program 100.0%
Applied rewrites65.6%
if 4.99999999999999977e-163 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.8%
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-eval47.5
Applied rewrites47.5%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f645.8
Applied rewrites5.8%
(FPCore (w l) :precision binary64 (if (<= w -8.2e-16) (exp (fma (log l) (exp w) (- w))) (* (pow l (exp w)) 1.0)))
double code(double w, double l) {
double tmp;
if (w <= -8.2e-16) {
tmp = exp(fma(log(l), exp(w), -w));
} else {
tmp = pow(l, exp(w)) * 1.0;
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -8.2e-16) tmp = exp(fma(log(l), exp(w), Float64(-w))); else tmp = Float64((l ^ exp(w)) * 1.0); end return tmp end
code[w_, l_] := If[LessEqual[w, -8.2e-16], N[Exp[N[(N[Log[l], $MachinePrecision] * N[Exp[w], $MachinePrecision] + (-w)), $MachinePrecision]], $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -8.2 \cdot 10^{-16}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \ell, e^{w}, -w\right)}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(e^{w}\right)} \cdot 1\\
\end{array}
\end{array}
if w < -8.20000000000000012e-16Initial program 99.7%
Taylor expanded in w around 0
+-commutativeN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites98.1%
Taylor expanded in w around inf
exp-to-powN/A
remove-double-negN/A
log-recN/A
distribute-lft-neg-inN/A
*-commutativeN/A
mul-1-negN/A
prod-expN/A
lower-exp.f64N/A
+-commutativeN/A
mul-1-negN/A
*-commutativeN/A
distribute-lft-neg-inN/A
log-recN/A
remove-double-negN/A
lower-fma.f64N/A
lower-log.f64N/A
lower-exp.f64N/A
lower-neg.f6499.7
Applied rewrites99.7%
if -8.20000000000000012e-16 < w Initial program 99.9%
Taylor expanded in w around 0
Applied rewrites99.8%
Final simplification99.8%
(FPCore (w l) :precision binary64 (if (<= (* (exp (- w)) (pow l (exp w))) 1.1e-154) 0.0 1.0))
double code(double w, double l) {
double tmp;
if ((exp(-w) * pow(l, exp(w))) <= 1.1e-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.1d-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.1e-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.1e-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.1e-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.1e-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.1e-154], 0.0, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \leq 1.1 \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.10000000000000004e-154Initial program 100.0%
Applied rewrites65.6%
if 1.10000000000000004e-154 < (*.f64 (exp.f64 (neg.f64 w)) (pow.f64 l (exp.f64 w))) Initial program 99.8%
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-eval47.5
Applied rewrites47.5%
Taylor expanded in w around 0
Applied rewrites4.6%
(FPCore (w l) :precision binary64 (if (<= l 1.0) (* (- 1.0 w) (pow l (+ w 1.0))) (* (fma w (fma w 0.5 -1.0) 1.0) (pow l (fma w (fma 0.5 w 1.0) 1.0)))))
double code(double w, double l) {
double tmp;
if (l <= 1.0) {
tmp = (1.0 - w) * pow(l, (w + 1.0));
} else {
tmp = fma(w, fma(w, 0.5, -1.0), 1.0) * pow(l, fma(w, fma(0.5, w, 1.0), 1.0));
}
return tmp;
}
function code(w, l) tmp = 0.0 if (l <= 1.0) tmp = Float64(Float64(1.0 - w) * (l ^ Float64(w + 1.0))); else tmp = Float64(fma(w, fma(w, 0.5, -1.0), 1.0) * (l ^ fma(w, fma(0.5, w, 1.0), 1.0))); end return tmp end
code[w_, l_] := If[LessEqual[l, 1.0], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[l, N[(w * N[(0.5 * w + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1:\\
\;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(w + 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, -1\right), 1\right) \cdot {\ell}^{\left(\mathsf{fma}\left(w, \mathsf{fma}\left(0.5, w, 1\right), 1\right)\right)}\\
\end{array}
\end{array}
if l < 1Initial program 99.9%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6471.5
Applied rewrites71.5%
Taylor expanded in w around 0
lower-+.f6499.9
Applied rewrites99.9%
if 1 < l Initial program 99.8%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6490.9
Applied rewrites90.9%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6498.6
Applied rewrites98.6%
Taylor expanded in w around 0
Applied rewrites99.6%
Final simplification99.7%
(FPCore (w l) :precision binary64 (if (<= w -0.68) (exp (- w)) (if (<= w 125.0) (* 1.0 (pow l 1.0)) 0.0)))
double code(double w, double l) {
double tmp;
if (w <= -0.68) {
tmp = exp(-w);
} else if (w <= 125.0) {
tmp = 1.0 * pow(l, 1.0);
} else {
tmp = 0.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.68d0)) then
tmp = exp(-w)
else if (w <= 125.0d0) then
tmp = 1.0d0 * (l ** 1.0d0)
else
tmp = 0.0d0
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.68) {
tmp = Math.exp(-w);
} else if (w <= 125.0) {
tmp = 1.0 * Math.pow(l, 1.0);
} else {
tmp = 0.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.68: tmp = math.exp(-w) elif w <= 125.0: tmp = 1.0 * math.pow(l, 1.0) else: tmp = 0.0 return tmp
function code(w, l) tmp = 0.0 if (w <= -0.68) tmp = exp(Float64(-w)); elseif (w <= 125.0) tmp = Float64(1.0 * (l ^ 1.0)); else tmp = 0.0; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.68) tmp = exp(-w); elseif (w <= 125.0) tmp = 1.0 * (l ^ 1.0); else tmp = 0.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.68], N[Exp[(-w)], $MachinePrecision], If[LessEqual[w, 125.0], N[(1.0 * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.68:\\
\;\;\;\;e^{-w}\\
\mathbf{elif}\;w \leq 125:\\
\;\;\;\;1 \cdot {\ell}^{1}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -0.680000000000000049Initial 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 -0.680000000000000049 < w < 125Initial program 99.7%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6498.7
Applied rewrites98.7%
Taylor expanded in w around 0
lower-+.f6498.6
Applied rewrites98.6%
Taylor expanded in w around 0
Applied rewrites99.0%
Taylor expanded in w around 0
Applied rewrites97.9%
if 125 < w Initial program 100.0%
Applied rewrites100.0%
(FPCore (w l) :precision binary64 (if (<= w -1.0) (exp (- w)) (* (pow l (+ w 1.0)) 1.0)))
double code(double w, double l) {
double tmp;
if (w <= -1.0) {
tmp = exp(-w);
} else {
tmp = pow(l, (w + 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 <= (-1.0d0)) then
tmp = exp(-w)
else
tmp = (l ** (w + 1.0d0)) * 1.0d0
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 = Math.pow(l, (w + 1.0)) * 1.0;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.0: tmp = math.exp(-w) else: tmp = math.pow(l, (w + 1.0)) * 1.0 return tmp
function code(w, l) tmp = 0.0 if (w <= -1.0) tmp = exp(Float64(-w)); else tmp = Float64((l ^ Float64(w + 1.0)) * 1.0); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.0) tmp = exp(-w); else tmp = (l ^ (w + 1.0)) * 1.0; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.0], N[Exp[(-w)], $MachinePrecision], N[(N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(w + 1\right)} \cdot 1\\
\end{array}
\end{array}
if w < -1Initial 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 -1 < w Initial program 99.8%
Taylor expanded in w around 0
neg-mul-1N/A
unsub-negN/A
lower--.f6499.0
Applied rewrites99.0%
Taylor expanded in w around 0
lower-+.f6498.9
Applied rewrites98.9%
Taylor expanded in w around 0
Applied rewrites99.3%
Final simplification99.5%
(FPCore (w l)
:precision binary64
(let* ((t_0 (* w (fma w 0.5 -1.0))))
(if (<= w -2e+154)
(* w (* w 0.5))
(if (<= w -1.65e+77)
(fma
(* w (fma (* w (* w w)) 0.125 -1.0))
(/ 1.0 (fma w (fma w 0.25 0.5) 1.0))
1.0)
(if (<= w 125.0)
(/
(fma t_0 (* t_0 t_0) 1.0)
(+ 1.0 (* t_0 (fma w (fma w 0.5 -1.0) -1.0))))
0.0)))))
double code(double w, double l) {
double t_0 = w * fma(w, 0.5, -1.0);
double tmp;
if (w <= -2e+154) {
tmp = w * (w * 0.5);
} else if (w <= -1.65e+77) {
tmp = fma((w * fma((w * (w * w)), 0.125, -1.0)), (1.0 / fma(w, fma(w, 0.25, 0.5), 1.0)), 1.0);
} else if (w <= 125.0) {
tmp = fma(t_0, (t_0 * t_0), 1.0) / (1.0 + (t_0 * fma(w, fma(w, 0.5, -1.0), -1.0)));
} else {
tmp = 0.0;
}
return tmp;
}
function code(w, l) t_0 = Float64(w * fma(w, 0.5, -1.0)) tmp = 0.0 if (w <= -2e+154) tmp = Float64(w * Float64(w * 0.5)); elseif (w <= -1.65e+77) tmp = fma(Float64(w * fma(Float64(w * Float64(w * w)), 0.125, -1.0)), Float64(1.0 / fma(w, fma(w, 0.25, 0.5), 1.0)), 1.0); elseif (w <= 125.0) tmp = Float64(fma(t_0, Float64(t_0 * t_0), 1.0) / Float64(1.0 + Float64(t_0 * fma(w, fma(w, 0.5, -1.0), -1.0)))); else tmp = 0.0; end return tmp end
code[w_, l_] := Block[{t$95$0 = N[(w * N[(w * 0.5 + -1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -2e+154], N[(w * N[(w * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, -1.65e+77], N[(N[(w * N[(N[(w * N[(w * w), $MachinePrecision]), $MachinePrecision] * 0.125 + -1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(w * N[(w * 0.25 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[w, 125.0], N[(N[(t$95$0 * N[(t$95$0 * t$95$0), $MachinePrecision] + 1.0), $MachinePrecision] / N[(1.0 + N[(t$95$0 * N[(w * N[(w * 0.5 + -1.0), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := w \cdot \mathsf{fma}\left(w, 0.5, -1\right)\\
\mathbf{if}\;w \leq -2 \cdot 10^{+154}:\\
\;\;\;\;w \cdot \left(w \cdot 0.5\right)\\
\mathbf{elif}\;w \leq -1.65 \cdot 10^{+77}:\\
\;\;\;\;\mathsf{fma}\left(w \cdot \mathsf{fma}\left(w \cdot \left(w \cdot w\right), 0.125, -1\right), \frac{1}{\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.25, 0.5\right), 1\right)}, 1\right)\\
\mathbf{elif}\;w \leq 125:\\
\;\;\;\;\frac{\mathsf{fma}\left(t\_0, t\_0 \cdot t\_0, 1\right)}{1 + t\_0 \cdot \mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.5, -1\right), -1\right)}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.00000000000000007e154Initial 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
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in w around inf
Applied rewrites100.0%
if -2.00000000000000007e154 < w < -1.6499999999999999e77Initial 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
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f646.6
Applied rewrites6.6%
Applied rewrites100.0%
if -1.6499999999999999e77 < w < 125Initial 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-eval15.3
Applied rewrites15.3%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f645.2
Applied rewrites5.2%
Applied rewrites8.6%
if 125 < w Initial program 100.0%
Applied rewrites100.0%
Final simplification48.6%
(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.8%
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-eval52.3
Applied rewrites52.3%
lift-*.f64N/A
lift-exp.f64N/A
lift-neg.f64N/A
*-rgt-identityN/A
lift-neg.f64N/A
lift-exp.f6452.3
Applied rewrites52.3%
(FPCore (w l)
:precision binary64
(if (<= w -2e+154)
(* w (* w 0.5))
(if (<= w 125.0)
(fma
(* w (fma (* w (* w w)) 0.125 -1.0))
(/ 1.0 (fma w (fma w 0.25 0.5) 1.0))
1.0)
0.0)))
double code(double w, double l) {
double tmp;
if (w <= -2e+154) {
tmp = w * (w * 0.5);
} else if (w <= 125.0) {
tmp = fma((w * fma((w * (w * w)), 0.125, -1.0)), (1.0 / fma(w, fma(w, 0.25, 0.5), 1.0)), 1.0);
} else {
tmp = 0.0;
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -2e+154) tmp = Float64(w * Float64(w * 0.5)); elseif (w <= 125.0) tmp = fma(Float64(w * fma(Float64(w * Float64(w * w)), 0.125, -1.0)), Float64(1.0 / fma(w, fma(w, 0.25, 0.5), 1.0)), 1.0); else tmp = 0.0; end return tmp end
code[w_, l_] := If[LessEqual[w, -2e+154], N[(w * N[(w * 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[w, 125.0], N[(N[(w * N[(N[(w * N[(w * w), $MachinePrecision]), $MachinePrecision] * 0.125 + -1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(w * N[(w * 0.25 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision], 0.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2 \cdot 10^{+154}:\\
\;\;\;\;w \cdot \left(w \cdot 0.5\right)\\
\mathbf{elif}\;w \leq 125:\\
\;\;\;\;\mathsf{fma}\left(w \cdot \mathsf{fma}\left(w \cdot \left(w \cdot w\right), 0.125, -1\right), \frac{1}{\mathsf{fma}\left(w, \mathsf{fma}\left(w, 0.25, 0.5\right), 1\right)}, 1\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -2.00000000000000007e154Initial 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
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in w around inf
Applied rewrites100.0%
if -2.00000000000000007e154 < w < 125Initial program 99.8%
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-eval27.8
Applied rewrites27.8%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f645.4
Applied rewrites5.4%
Applied rewrites19.3%
if 125 < w Initial program 100.0%
Applied rewrites100.0%
Final simplification46.7%
(FPCore (w l) :precision binary64 (if (<= w -4e-310) (* w (fma w 0.5 -1.0)) 0.0))
double code(double w, double l) {
double tmp;
if (w <= -4e-310) {
tmp = w * fma(w, 0.5, -1.0);
} else {
tmp = 0.0;
}
return tmp;
}
function code(w, l) tmp = 0.0 if (w <= -4e-310) tmp = Float64(w * fma(w, 0.5, -1.0)); else tmp = 0.0; end return tmp end
code[w_, l_] := If[LessEqual[w, -4e-310], N[(w * N[(w * 0.5 + -1.0), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -4 \cdot 10^{-310}:\\
\;\;\;\;w \cdot \mathsf{fma}\left(w, 0.5, -1\right)\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}
\end{array}
if w < -3.999999999999988e-310Initial program 99.8%
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-eval55.8
Applied rewrites55.8%
Taylor expanded in w around 0
+-commutativeN/A
lower-fma.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f6430.9
Applied rewrites30.9%
Taylor expanded in w around inf
Applied rewrites30.8%
if -3.999999999999988e-310 < w Initial program 99.9%
Applied rewrites46.2%
(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.8%
Applied rewrites20.3%
herbie shell --seed 2024233
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))