
(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 9 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 (/ (pow l (exp w)) (exp w)))
double code(double w, double l) {
return pow(l, exp(w)) / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = (l ** exp(w)) / exp(w)
end function
public static double code(double w, double l) {
return Math.pow(l, Math.exp(w)) / Math.exp(w);
}
def code(w, l): return math.pow(l, math.exp(w)) / math.exp(w)
function code(w, l) return Float64((l ^ exp(w)) / exp(w)) end
function tmp = code(w, l) tmp = (l ^ exp(w)) / exp(w); end
code[w_, l_] := N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}
\end{array}
Initial program 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (w l)
:precision binary64
(if (<= w -2.5e+239)
(fabs (* l (* w (+ (log l) 1.0))))
(if (or (<= w -1.55e+109) (not (<= w 2.5)))
(/ (* l (* w (log l))) (exp w))
(+ l (fabs (* l (* w (+ (log l) -1.0))))))))
double code(double w, double l) {
double tmp;
if (w <= -2.5e+239) {
tmp = fabs((l * (w * (log(l) + 1.0))));
} else if ((w <= -1.55e+109) || !(w <= 2.5)) {
tmp = (l * (w * log(l))) / exp(w);
} else {
tmp = l + fabs((l * (w * (log(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 <= (-2.5d+239)) then
tmp = abs((l * (w * (log(l) + 1.0d0))))
else if ((w <= (-1.55d+109)) .or. (.not. (w <= 2.5d0))) then
tmp = (l * (w * log(l))) / exp(w)
else
tmp = l + abs((l * (w * (log(l) + (-1.0d0)))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -2.5e+239) {
tmp = Math.abs((l * (w * (Math.log(l) + 1.0))));
} else if ((w <= -1.55e+109) || !(w <= 2.5)) {
tmp = (l * (w * Math.log(l))) / Math.exp(w);
} else {
tmp = l + Math.abs((l * (w * (Math.log(l) + -1.0))));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -2.5e+239: tmp = math.fabs((l * (w * (math.log(l) + 1.0)))) elif (w <= -1.55e+109) or not (w <= 2.5): tmp = (l * (w * math.log(l))) / math.exp(w) else: tmp = l + math.fabs((l * (w * (math.log(l) + -1.0)))) return tmp
function code(w, l) tmp = 0.0 if (w <= -2.5e+239) tmp = abs(Float64(l * Float64(w * Float64(log(l) + 1.0)))); elseif ((w <= -1.55e+109) || !(w <= 2.5)) tmp = Float64(Float64(l * Float64(w * log(l))) / exp(w)); else tmp = Float64(l + abs(Float64(l * Float64(w * Float64(log(l) + -1.0))))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -2.5e+239) tmp = abs((l * (w * (log(l) + 1.0)))); elseif ((w <= -1.55e+109) || ~((w <= 2.5))) tmp = (l * (w * log(l))) / exp(w); else tmp = l + abs((l * (w * (log(l) + -1.0)))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -2.5e+239], N[Abs[N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[w, -1.55e+109], N[Not[LessEqual[w, 2.5]], $MachinePrecision]], N[(N[(l * N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[(l + N[Abs[N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -2.5 \cdot 10^{+239}:\\
\;\;\;\;\left|\ell \cdot \left(w \cdot \left(\log \ell + 1\right)\right)\right|\\
\mathbf{elif}\;w \leq -1.55 \cdot 10^{+109} \lor \neg \left(w \leq 2.5\right):\\
\;\;\;\;\frac{\ell \cdot \left(w \cdot \log \ell\right)}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;\ell + \left|\ell \cdot \left(w \cdot \left(\log \ell + -1\right)\right)\right|\\
\end{array}
\end{array}
if w < -2.50000000000000003e239Initial 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 w around 0 1.8%
sub-neg1.8%
distribute-rgt-in1.8%
*-commutative1.8%
associate-*r*1.8%
Applied egg-rr1.8%
add-sqr-sqrt1.8%
sqrt-unprod21.5%
pow221.5%
fma-define21.5%
add-sqr-sqrt0.0%
sqrt-unprod79.9%
sqr-neg79.9%
sqrt-unprod79.9%
add-sqr-sqrt79.9%
Applied egg-rr79.9%
unpow279.9%
rem-sqrt-square60.6%
fma-undefine60.6%
distribute-lft1-in60.6%
distribute-rgt1-in60.6%
*-lft-identity60.6%
distribute-rgt-out60.6%
Simplified60.6%
Taylor expanded in l around 0 64.6%
if -2.50000000000000003e239 < w < -1.54999999999999996e109 or 2.5 < w Initial program 98.1%
exp-neg98.1%
remove-double-neg98.1%
associate-*l/98.1%
*-lft-identity98.1%
remove-double-neg98.1%
Simplified98.1%
Taylor expanded in w around 0 74.2%
associate-*r*74.2%
Simplified74.2%
Taylor expanded in w around inf 74.2%
if -1.54999999999999996e109 < w < 2.5Initial program 99.9%
exp-neg99.9%
remove-double-neg99.9%
associate-*l/99.9%
*-lft-identity99.9%
remove-double-neg99.9%
Simplified99.9%
Taylor expanded in w around 0 83.8%
add-sqr-sqrt3.4%
sqrt-unprod12.8%
pow212.8%
sub-neg12.8%
distribute-rgt-in9.4%
neg-mul-19.4%
*-commutative9.4%
distribute-rgt-in12.8%
distribute-lft-in12.8%
associate-*r*12.8%
*-commutative12.8%
Applied egg-rr88.6%
unpow212.8%
rem-sqrt-square8.9%
associate-*r*8.9%
+-commutative8.9%
Simplified87.5%
Final simplification82.5%
(FPCore (w l)
:precision binary64
(if (<= w -1.4e+237)
(fabs (* l (* w (+ (log l) 1.0))))
(if (or (<= w -3.8e+19) (not (<= w 1.25)))
(/ (* l (* w (log l))) (exp w))
(+ l (* l (* w (+ (log l) -1.0)))))))
double code(double w, double l) {
double tmp;
if (w <= -1.4e+237) {
tmp = fabs((l * (w * (log(l) + 1.0))));
} else if ((w <= -3.8e+19) || !(w <= 1.25)) {
tmp = (l * (w * log(l))) / exp(w);
} else {
tmp = l + (l * (w * (log(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 <= (-1.4d+237)) then
tmp = abs((l * (w * (log(l) + 1.0d0))))
else if ((w <= (-3.8d+19)) .or. (.not. (w <= 1.25d0))) then
tmp = (l * (w * log(l))) / exp(w)
else
tmp = l + (l * (w * (log(l) + (-1.0d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.4e+237) {
tmp = Math.abs((l * (w * (Math.log(l) + 1.0))));
} else if ((w <= -3.8e+19) || !(w <= 1.25)) {
tmp = (l * (w * Math.log(l))) / Math.exp(w);
} else {
tmp = l + (l * (w * (Math.log(l) + -1.0)));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.4e+237: tmp = math.fabs((l * (w * (math.log(l) + 1.0)))) elif (w <= -3.8e+19) or not (w <= 1.25): tmp = (l * (w * math.log(l))) / math.exp(w) else: tmp = l + (l * (w * (math.log(l) + -1.0))) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.4e+237) tmp = abs(Float64(l * Float64(w * Float64(log(l) + 1.0)))); elseif ((w <= -3.8e+19) || !(w <= 1.25)) tmp = Float64(Float64(l * Float64(w * log(l))) / exp(w)); else tmp = Float64(l + Float64(l * Float64(w * Float64(log(l) + -1.0)))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.4e+237) tmp = abs((l * (w * (log(l) + 1.0)))); elseif ((w <= -3.8e+19) || ~((w <= 1.25))) tmp = (l * (w * log(l))) / exp(w); else tmp = l + (l * (w * (log(l) + -1.0))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.4e+237], N[Abs[N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[Or[LessEqual[w, -3.8e+19], N[Not[LessEqual[w, 1.25]], $MachinePrecision]], N[(N[(l * N[(w * N[Log[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[(l + N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.4 \cdot 10^{+237}:\\
\;\;\;\;\left|\ell \cdot \left(w \cdot \left(\log \ell + 1\right)\right)\right|\\
\mathbf{elif}\;w \leq -3.8 \cdot 10^{+19} \lor \neg \left(w \leq 1.25\right):\\
\;\;\;\;\frac{\ell \cdot \left(w \cdot \log \ell\right)}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(\log \ell + -1\right)\right)\\
\end{array}
\end{array}
if w < -1.39999999999999992e237Initial 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 w around 0 1.8%
sub-neg1.8%
distribute-rgt-in1.8%
*-commutative1.8%
associate-*r*1.8%
Applied egg-rr1.8%
add-sqr-sqrt1.8%
sqrt-unprod21.5%
pow221.5%
fma-define21.5%
add-sqr-sqrt0.0%
sqrt-unprod79.9%
sqr-neg79.9%
sqrt-unprod79.9%
add-sqr-sqrt79.9%
Applied egg-rr79.9%
unpow279.9%
rem-sqrt-square60.6%
fma-undefine60.6%
distribute-lft1-in60.6%
distribute-rgt1-in60.6%
*-lft-identity60.6%
distribute-rgt-out60.6%
Simplified60.6%
Taylor expanded in l around 0 64.6%
if -1.39999999999999992e237 < w < -3.8e19 or 1.25 < w Initial program 98.7%
exp-neg98.7%
remove-double-neg98.7%
associate-*l/98.7%
*-lft-identity98.7%
remove-double-neg98.7%
Simplified98.7%
Taylor expanded in w around 0 59.0%
associate-*r*59.0%
Simplified59.0%
Taylor expanded in w around inf 59.0%
if -3.8e19 < w < 1.25Initial program 99.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in w around 0 96.8%
Taylor expanded in l around 0 96.8%
Final simplification82.2%
(FPCore (w l) :precision binary64 (if (<= l 0.0065) (/ (+ l (* (* l w) (log l))) (exp w)) (+ l (fabs (* (* l w) (+ (log l) 1.0))))))
double code(double w, double l) {
double tmp;
if (l <= 0.0065) {
tmp = (l + ((l * w) * log(l))) / exp(w);
} else {
tmp = l + fabs(((l * w) * (log(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 (l <= 0.0065d0) then
tmp = (l + ((l * w) * log(l))) / exp(w)
else
tmp = l + abs(((l * w) * (log(l) + 1.0d0)))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (l <= 0.0065) {
tmp = (l + ((l * w) * Math.log(l))) / Math.exp(w);
} else {
tmp = l + Math.abs(((l * w) * (Math.log(l) + 1.0)));
}
return tmp;
}
def code(w, l): tmp = 0 if l <= 0.0065: tmp = (l + ((l * w) * math.log(l))) / math.exp(w) else: tmp = l + math.fabs(((l * w) * (math.log(l) + 1.0))) return tmp
function code(w, l) tmp = 0.0 if (l <= 0.0065) tmp = Float64(Float64(l + Float64(Float64(l * w) * log(l))) / exp(w)); else tmp = Float64(l + abs(Float64(Float64(l * w) * Float64(log(l) + 1.0)))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (l <= 0.0065) tmp = (l + ((l * w) * log(l))) / exp(w); else tmp = l + abs(((l * w) * (log(l) + 1.0))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[l, 0.0065], N[(N[(l + N[(N[(l * w), $MachinePrecision] * N[Log[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[(l + N[Abs[N[(N[(l * w), $MachinePrecision] * N[(N[Log[l], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 0.0065:\\
\;\;\;\;\frac{\ell + \left(\ell \cdot w\right) \cdot \log \ell}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;\ell + \left|\left(\ell \cdot w\right) \cdot \left(\log \ell + 1\right)\right|\\
\end{array}
\end{array}
if l < 0.0064999999999999997Initial program 99.8%
exp-neg99.8%
remove-double-neg99.8%
associate-*l/99.8%
*-lft-identity99.8%
remove-double-neg99.8%
Simplified99.8%
Taylor expanded in w around 0 98.5%
associate-*r*98.5%
Simplified98.5%
if 0.0064999999999999997 < l Initial program 99.2%
exp-neg99.2%
remove-double-neg99.2%
associate-*l/99.2%
*-lft-identity99.2%
remove-double-neg99.2%
Simplified99.2%
Taylor expanded in w around 0 59.1%
sub-neg59.1%
distribute-rgt-in59.1%
*-commutative59.1%
associate-*r*59.1%
Applied egg-rr59.1%
add-sqr-sqrt30.4%
sqrt-unprod69.5%
pow269.5%
fma-define69.5%
add-sqr-sqrt0.0%
sqrt-unprod69.8%
sqr-neg69.8%
sqrt-unprod88.4%
add-sqr-sqrt88.4%
Applied egg-rr88.4%
unpow288.4%
rem-sqrt-square79.9%
fma-undefine79.9%
distribute-lft1-in79.9%
distribute-rgt1-in79.9%
*-lft-identity79.9%
distribute-rgt-out79.9%
Simplified79.9%
Final simplification89.7%
(FPCore (w l) :precision binary64 (let* ((t_0 (* l (* w (+ (log l) -1.0))))) (if (<= w -0.0022) (fabs t_0) (+ l t_0))))
double code(double w, double l) {
double t_0 = l * (w * (log(l) + -1.0));
double tmp;
if (w <= -0.0022) {
tmp = fabs(t_0);
} else {
tmp = l + 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 = l * (w * (log(l) + (-1.0d0)))
if (w <= (-0.0022d0)) then
tmp = abs(t_0)
else
tmp = l + t_0
end if
code = tmp
end function
public static double code(double w, double l) {
double t_0 = l * (w * (Math.log(l) + -1.0));
double tmp;
if (w <= -0.0022) {
tmp = Math.abs(t_0);
} else {
tmp = l + t_0;
}
return tmp;
}
def code(w, l): t_0 = l * (w * (math.log(l) + -1.0)) tmp = 0 if w <= -0.0022: tmp = math.fabs(t_0) else: tmp = l + t_0 return tmp
function code(w, l) t_0 = Float64(l * Float64(w * Float64(log(l) + -1.0))) tmp = 0.0 if (w <= -0.0022) tmp = abs(t_0); else tmp = Float64(l + t_0); end return tmp end
function tmp_2 = code(w, l) t_0 = l * (w * (log(l) + -1.0)); tmp = 0.0; if (w <= -0.0022) tmp = abs(t_0); else tmp = l + t_0; end tmp_2 = tmp; end
code[w_, l_] := Block[{t$95$0 = N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -0.0022], N[Abs[t$95$0], $MachinePrecision], N[(l + t$95$0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \ell \cdot \left(w \cdot \left(\log \ell + -1\right)\right)\\
\mathbf{if}\;w \leq -0.0022:\\
\;\;\;\;\left|t\_0\right|\\
\mathbf{else}:\\
\;\;\;\;\ell + t\_0\\
\end{array}
\end{array}
if w < -0.00220000000000000013Initial 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 w around 0 1.6%
Taylor expanded in w around inf 1.6%
add-sqr-sqrt1.5%
sqrt-unprod60.6%
pow260.6%
sub-neg60.6%
distribute-rgt-in32.2%
neg-mul-132.2%
*-commutative32.2%
distribute-rgt-in60.6%
distribute-lft-in60.6%
associate-*r*60.6%
*-commutative60.6%
Applied egg-rr60.6%
unpow260.6%
rem-sqrt-square33.0%
associate-*r*34.2%
+-commutative34.2%
Simplified34.2%
if -0.00220000000000000013 < w Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
Taylor expanded in w around 0 85.6%
Taylor expanded in l around 0 85.6%
Final simplification69.3%
(FPCore (w l) :precision binary64 (if (<= w -0.0032) (fabs (* l (* w (+ (log l) 1.0)))) (+ l (* l (* w (+ (log l) -1.0))))))
double code(double w, double l) {
double tmp;
if (w <= -0.0032) {
tmp = fabs((l * (w * (log(l) + 1.0))));
} else {
tmp = l + (l * (w * (log(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.0032d0)) then
tmp = abs((l * (w * (log(l) + 1.0d0))))
else
tmp = l + (l * (w * (log(l) + (-1.0d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.0032) {
tmp = Math.abs((l * (w * (Math.log(l) + 1.0))));
} else {
tmp = l + (l * (w * (Math.log(l) + -1.0)));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.0032: tmp = math.fabs((l * (w * (math.log(l) + 1.0)))) else: tmp = l + (l * (w * (math.log(l) + -1.0))) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.0032) tmp = abs(Float64(l * Float64(w * Float64(log(l) + 1.0)))); else tmp = Float64(l + Float64(l * Float64(w * Float64(log(l) + -1.0)))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.0032) tmp = abs((l * (w * (log(l) + 1.0)))); else tmp = l + (l * (w * (log(l) + -1.0))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.0032], N[Abs[N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(l + N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.0032:\\
\;\;\;\;\left|\ell \cdot \left(w \cdot \left(\log \ell + 1\right)\right)\right|\\
\mathbf{else}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(\log \ell + -1\right)\right)\\
\end{array}
\end{array}
if w < -0.00320000000000000015Initial 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 w around 0 1.6%
sub-neg1.6%
distribute-rgt-in1.6%
*-commutative1.6%
associate-*r*1.6%
Applied egg-rr1.6%
add-sqr-sqrt1.5%
sqrt-unprod32.2%
pow232.2%
fma-define32.2%
add-sqr-sqrt0.0%
sqrt-unprod60.6%
sqr-neg60.6%
sqrt-unprod60.6%
add-sqr-sqrt60.6%
Applied egg-rr60.6%
unpow260.6%
rem-sqrt-square33.0%
fma-undefine33.0%
distribute-lft1-in33.0%
distribute-rgt1-in33.0%
*-lft-identity33.0%
distribute-rgt-out33.0%
Simplified33.0%
Taylor expanded in l around 0 34.2%
if -0.00320000000000000015 < w Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
Taylor expanded in w around 0 85.6%
Taylor expanded in l around 0 85.6%
Final simplification69.3%
(FPCore (w l) :precision binary64 (if (<= w -0.00335) (* l (- w)) (+ l (* l (* w (+ (log l) -1.0))))))
double code(double w, double l) {
double tmp;
if (w <= -0.00335) {
tmp = l * -w;
} else {
tmp = l + (l * (w * (log(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.00335d0)) then
tmp = l * -w
else
tmp = l + (l * (w * (log(l) + (-1.0d0))))
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.00335) {
tmp = l * -w;
} else {
tmp = l + (l * (w * (Math.log(l) + -1.0)));
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.00335: tmp = l * -w else: tmp = l + (l * (w * (math.log(l) + -1.0))) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.00335) tmp = Float64(l * Float64(-w)); else tmp = Float64(l + Float64(l * Float64(w * Float64(log(l) + -1.0)))); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.00335) tmp = l * -w; else tmp = l + (l * (w * (log(l) + -1.0))); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.00335], N[(l * (-w)), $MachinePrecision], N[(l + N[(l * N[(w * N[(N[Log[l], $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.00335:\\
\;\;\;\;\ell \cdot \left(-w\right)\\
\mathbf{else}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(\log \ell + -1\right)\right)\\
\end{array}
\end{array}
if w < -0.00335000000000000011Initial 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 w around 0 1.6%
Taylor expanded in w around inf 1.6%
add-log-exp1.5%
*-commutative1.5%
exp-to-pow1.5%
Applied egg-rr1.5%
Taylor expanded in l around inf 32.0%
neg-mul-132.0%
Simplified32.0%
if -0.00335000000000000011 < w Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
Taylor expanded in w around 0 85.6%
Taylor expanded in l around 0 85.6%
Final simplification68.6%
(FPCore (w l) :precision binary64 (if (<= w -0.09) (* l (- w)) l))
double code(double w, double l) {
double tmp;
if (w <= -0.09) {
tmp = l * -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.09d0)) then
tmp = l * -w
else
tmp = l
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.09) {
tmp = l * -w;
} else {
tmp = l;
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.09: tmp = l * -w else: tmp = l return tmp
function code(w, l) tmp = 0.0 if (w <= -0.09) tmp = Float64(l * Float64(-w)); else tmp = l; end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.09) tmp = l * -w; else tmp = l; end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.09], N[(l * (-w)), $MachinePrecision], l]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.09:\\
\;\;\;\;\ell \cdot \left(-w\right)\\
\mathbf{else}:\\
\;\;\;\;\ell\\
\end{array}
\end{array}
if w < -0.089999999999999997Initial 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 w around 0 1.6%
Taylor expanded in w around inf 1.6%
add-log-exp1.5%
*-commutative1.5%
exp-to-pow1.5%
Applied egg-rr1.5%
Taylor expanded in l around inf 32.0%
neg-mul-132.0%
Simplified32.0%
if -0.089999999999999997 < w Initial program 99.3%
exp-neg99.3%
remove-double-neg99.3%
associate-*l/99.3%
*-lft-identity99.3%
remove-double-neg99.3%
Simplified99.3%
Taylor expanded in w around 0 85.6%
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 99.5%
exp-neg99.5%
remove-double-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in w around 0 59.8%
Final simplification59.8%
herbie shell --seed 2024053
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))