
(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 10 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 (+ 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 <= -1.6) {
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 <= (-1.6d0)) 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 <= -1.6) {
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 <= -1.6: 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 <= -1.6) 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 <= -1.6) 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, -1.6], 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 -1.6:\\
\;\;\;\;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 < -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%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -1.6000000000000001 < w Initial program 98.4%
exp-neg98.4%
remove-double-neg98.4%
associate-*l/98.4%
*-lft-identity98.4%
remove-double-neg98.4%
Simplified98.4%
Taylor expanded in w around 0 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in w around 0 99.6%
*-commutative99.6%
Simplified99.6%
(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 98.9%
exp-neg98.9%
remove-double-neg98.9%
associate-*l/98.9%
*-lft-identity98.9%
remove-double-neg98.9%
Simplified98.9%
(FPCore (w l) :precision binary64 (let* ((t_0 (+ 1.0 (* w (+ 1.0 (* w 0.5)))))) (if (<= w -57000.0) (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 <= -57000.0) {
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 <= (-57000.0d0)) 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 <= -57000.0) {
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 <= -57000.0: 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 <= -57000.0) 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 <= -57000.0) 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, -57000.0], 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 -57000:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{t\_0}}{t\_0}\\
\end{array}
\end{array}
if w < -57000Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -57000 < w Initial program 98.4%
exp-neg98.4%
remove-double-neg98.4%
associate-*l/98.4%
*-lft-identity98.4%
remove-double-neg98.4%
Simplified98.4%
Taylor expanded in w around 0 99.0%
*-commutative99.0%
Simplified99.0%
Taylor expanded in w around 0 99.5%
*-commutative99.0%
Simplified99.5%
(FPCore (w l) :precision binary64 (if (<= w -1.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 <= -1.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 <= (-1.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 <= -1.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 <= -1.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 <= -1.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 <= -1.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, -1.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 -1:\\
\;\;\;\;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 < -1Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -1 < w Initial program 98.4%
exp-neg98.4%
remove-double-neg98.4%
associate-*l/98.4%
*-lft-identity98.4%
remove-double-neg98.4%
Simplified98.4%
Taylor expanded in w around 0 99.6%
*-commutative99.6%
Simplified99.6%
Taylor expanded in w around 0 99.1%
+-commutative99.1%
Simplified99.1%
(FPCore (w l) :precision binary64 (if (or (<= w -0.7) (not (<= w 1900000.0))) (exp (- w)) l))
double code(double w, double l) {
double tmp;
if ((w <= -0.7) || !(w <= 1900000.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 <= 1900000.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 <= 1900000.0)) {
tmp = Math.exp(-w);
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if (w <= -0.7) or not (w <= 1900000.0): tmp = math.exp(-w) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if ((w <= -0.7) || !(w <= 1900000.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 <= 1900000.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, 1900000.0]], $MachinePrecision]], N[Exp[(-w)], $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.7 \lor \neg \left(w \leq 1900000\right):\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.69999999999999996 or 1.9e6 < 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%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -0.69999999999999996 < w < 1.9e6Initial program 98.0%
exp-neg98.0%
remove-double-neg98.0%
associate-*l/98.0%
*-lft-identity98.0%
remove-double-neg98.0%
Simplified98.0%
Taylor expanded in w around 0 94.9%
Final simplification97.2%
(FPCore (w l) :precision binary64 (if (<= w -1.02) (exp (- w)) (pow l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -1.02) {
tmp = exp(-w);
} else {
tmp = pow(l, (w + 1.0));
}
return tmp;
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
real(8) :: tmp
if (w <= (-1.02d0)) then
tmp = exp(-w)
else
tmp = l ** (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.02) {
tmp = Math.exp(-w);
} else {
tmp = Math.pow(l, (w + 1.0));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.02: tmp = math.exp(-w) else: tmp = math.pow(l, (w + 1.0)) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.02) tmp = exp(Float64(-w)); else tmp = l ^ Float64(w + 1.0); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.02) tmp = exp(-w); else tmp = l ^ (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.02], N[Exp[(-w)], $MachinePrecision], N[Power[l, N[(w + 1.0), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.02:\\
\;\;\;\;e^{-w}\\
\mathbf{else}:\\
\;\;\;\;{\ell}^{\left(w + 1\right)}\\
\end{array}
\end{array}
if w < -1.02Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
if -1.02 < w Initial program 98.4%
exp-neg98.4%
remove-double-neg98.4%
associate-*l/98.4%
*-lft-identity98.4%
remove-double-neg98.4%
Simplified98.4%
Taylor expanded in w around 0 98.2%
Taylor expanded in w around 0 98.2%
+-commutative99.1%
Simplified98.2%
Final simplification98.8%
(FPCore (w l) :precision binary64 (if (<= w -2.9e+63) (+ 1.0 (* w (+ (* w (+ 0.5 (* w -0.16666666666666666))) -1.0))) l))
double code(double w, double l) {
double tmp;
if (w <= -2.9e+63) {
tmp = 1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -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 <= (-2.9d+63)) then
tmp = 1.0d0 + (w * ((w * (0.5d0 + (w * (-0.16666666666666666d0)))) + (-1.0d0)))
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -2.9e+63) {
tmp = 1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0));
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -2.9e+63: tmp = 1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -2.9e+63) tmp = Float64(1.0 + Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))) + -1.0))); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -2.9e+63) tmp = 1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)); else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -2.9e+63], N[(1.0 + N[(w * N[(N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.9 \cdot 10^{+63}:\\
\;\;\;\;1 + w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -2.8999999999999999e63Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in w around 0 80.6%
if -2.8999999999999999e63 < w Initial program 98.5%
exp-neg98.5%
remove-double-neg98.5%
associate-*l/98.5%
*-lft-identity98.5%
remove-double-neg98.5%
Simplified98.5%
Taylor expanded in w around 0 70.9%
Final simplification73.4%
(FPCore (w l) :precision binary64 (if (<= w -2.9e+63) (+ 1.0 (* w (+ (* w 0.5) -1.0))) l))
double code(double w, double l) {
double tmp;
if (w <= -2.9e+63) {
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 <= (-2.9d+63)) 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 <= -2.9e+63) {
tmp = 1.0 + (w * ((w * 0.5) + -1.0));
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -2.9e+63: tmp = 1.0 + (w * ((w * 0.5) + -1.0)) else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -2.9e+63) 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 <= -2.9e+63) tmp = 1.0 + (w * ((w * 0.5) + -1.0)); else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -2.9e+63], 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 -2.9 \cdot 10^{+63}:\\
\;\;\;\;1 + w \cdot \left(w \cdot 0.5 + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -2.8999999999999999e63Initial program 100.0%
exp-neg100.0%
remove-double-neg100.0%
associate-*l/100.0%
*-lft-identity100.0%
remove-double-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
distribute-rgt-neg-in100.0%
log-rec100.0%
remove-double-neg100.0%
+-rgt-identity100.0%
exp-diff100.0%
+-rgt-identity100.0%
remove-double-neg100.0%
distribute-lft-neg-in100.0%
distribute-rgt-neg-out100.0%
Simplified100.0%
Taylor expanded in w around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in w around 0 62.3%
if -2.8999999999999999e63 < w Initial program 98.5%
exp-neg98.5%
remove-double-neg98.5%
associate-*l/98.5%
*-lft-identity98.5%
remove-double-neg98.5%
Simplified98.5%
Taylor expanded in w around 0 70.9%
Final simplification68.6%
(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 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 53.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 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 l around inf 94.4%
mul-1-neg94.4%
distribute-rgt-neg-in94.4%
log-rec94.4%
remove-double-neg94.4%
+-rgt-identity94.4%
exp-diff95.2%
+-rgt-identity95.2%
remove-double-neg95.2%
distribute-lft-neg-in95.2%
distribute-rgt-neg-out95.2%
Simplified95.2%
Taylor expanded in w around inf 49.0%
neg-mul-149.0%
Simplified49.0%
Taylor expanded in w around 0 4.3%
herbie shell --seed 2024137
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))