
(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 12 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 -222.0) (/ l (exp w)) (/ (pow l (exp w)) (+ (* w (+ (* w 0.5) 1.0)) 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -222.0) {
tmp = l / exp(w);
} else {
tmp = pow(l, exp(w)) / ((w * ((w * 0.5) + 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 <= (-222.0d0)) then
tmp = l / exp(w)
else
tmp = (l ** exp(w)) / ((w * ((w * 0.5d0) + 1.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -222.0) {
tmp = l / Math.exp(w);
} else {
tmp = Math.pow(l, Math.exp(w)) / ((w * ((w * 0.5) + 1.0)) + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -222.0: tmp = l / math.exp(w) else: tmp = math.pow(l, math.exp(w)) / ((w * ((w * 0.5) + 1.0)) + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -222.0) tmp = Float64(l / exp(w)); else tmp = Float64((l ^ exp(w)) / Float64(Float64(w * Float64(Float64(w * 0.5) + 1.0)) + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -222.0) tmp = l / exp(w); else tmp = (l ^ exp(w)) / ((w * ((w * 0.5) + 1.0)) + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -222.0], N[(l / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[(N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision] / N[(N[(w * N[(N[(w * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -222:\\
\;\;\;\;\frac{\ell}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(e^{w}\right)}}{w \cdot \left(w \cdot 0.5 + 1\right) + 1}\\
\end{array}
\end{array}
if w < -222Initial 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 100.0%
Taylor expanded in l around 0 100.0%
if -222 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in w around 0 99.2%
*-commutative99.2%
Simplified99.2%
Final simplification99.4%
(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.4%
(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.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
(FPCore (w l) :precision binary64 (if (<= w -1.0) (/ l (exp w)) (/ (pow l (+ (* w (+ (* w 0.5) 1.0)) 1.0)) (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -1.0) {
tmp = l / exp(w);
} else {
tmp = pow(l, ((w * ((w * 0.5) + 1.0)) + 1.0)) / (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.0d0)) then
tmp = l / exp(w)
else
tmp = (l ** ((w * ((w * 0.5d0) + 1.0d0)) + 1.0d0)) / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.0) {
tmp = l / Math.exp(w);
} else {
tmp = Math.pow(l, ((w * ((w * 0.5) + 1.0)) + 1.0)) / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.0: tmp = l / math.exp(w) else: tmp = math.pow(l, ((w * ((w * 0.5) + 1.0)) + 1.0)) / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.0) tmp = Float64(l / exp(w)); else tmp = Float64((l ^ Float64(Float64(w * Float64(Float64(w * 0.5) + 1.0)) + 1.0)) / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.0) tmp = l / exp(w); else tmp = (l ^ ((w * ((w * 0.5) + 1.0)) + 1.0)) / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.0], N[(l / N[Exp[w], $MachinePrecision]), $MachinePrecision], N[(N[Power[l, N[(N[(w * N[(N[(w * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]], $MachinePrecision] / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1:\\
\;\;\;\;\frac{\ell}{e^{w}}\\
\mathbf{else}:\\
\;\;\;\;\frac{{\ell}^{\left(w \cdot \left(w \cdot 0.5 + 1\right) + 1\right)}}{w + 1}\\
\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 w around 0 100.0%
Taylor expanded in l around 0 100.0%
if -1 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in w around 0 98.8%
+-commutative98.8%
Simplified98.8%
Taylor expanded in w around 0 98.8%
*-commutative99.2%
Simplified98.8%
Final simplification99.1%
(FPCore (w l) :precision binary64 (/ l (exp w)))
double code(double w, double l) {
return l / exp(w);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l / exp(w)
end function
public static double code(double w, double l) {
return l / Math.exp(w);
}
def code(w, l): return l / math.exp(w)
function code(w, l) return Float64(l / exp(w)) end
function tmp = code(w, l) tmp = l / exp(w); end
code[w_, l_] := N[(l / N[Exp[w], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\ell}{e^{w}}
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
Taylor expanded in w around 0 97.4%
Taylor expanded in l around 0 97.4%
(FPCore (w l) :precision binary64 (if (<= w -1.6) (+ l (* w (- (* w (+ (* -0.16666666666666666 (* w l)) (- l (* l 0.5)))) l))) (/ l (+ (* w (+ (* w (+ 0.5 (* w 0.16666666666666666))) 1.0)) 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -1.6) {
tmp = l + (w * ((w * ((-0.16666666666666666 * (w * l)) + (l - (l * 0.5)))) - l));
} else {
tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 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.6d0)) then
tmp = l + (w * ((w * (((-0.16666666666666666d0) * (w * l)) + (l - (l * 0.5d0)))) - l))
else
tmp = l / ((w * ((w * (0.5d0 + (w * 0.16666666666666666d0))) + 1.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -1.6) {
tmp = l + (w * ((w * ((-0.16666666666666666 * (w * l)) + (l - (l * 0.5)))) - l));
} else {
tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -1.6: tmp = l + (w * ((w * ((-0.16666666666666666 * (w * l)) + (l - (l * 0.5)))) - l)) else: tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -1.6) tmp = Float64(l + Float64(w * Float64(Float64(w * Float64(Float64(-0.16666666666666666 * Float64(w * l)) + Float64(l - Float64(l * 0.5)))) - l))); else tmp = Float64(l / Float64(Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * 0.16666666666666666))) + 1.0)) + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -1.6) tmp = l + (w * ((w * ((-0.16666666666666666 * (w * l)) + (l - (l * 0.5)))) - l)); else tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -1.6], N[(l + N[(w * N[(N[(w * N[(N[(-0.16666666666666666 * N[(w * l), $MachinePrecision]), $MachinePrecision] + N[(l - N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(N[(w * N[(N[(w * N[(0.5 + N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.6:\\
\;\;\;\;\ell + w \cdot \left(w \cdot \left(-0.16666666666666666 \cdot \left(w \cdot \ell\right) + \left(\ell - \ell \cdot 0.5\right)\right) - \ell\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w \cdot \left(w \cdot \left(0.5 + w \cdot 0.16666666666666666\right) + 1\right) + 1}\\
\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 w around 0 100.0%
Taylor expanded in w around 0 72.6%
Taylor expanded in l around 0 72.6%
if -1.6000000000000001 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in w around 0 96.5%
Taylor expanded in l around 0 96.5%
Taylor expanded in w around 0 93.3%
*-commutative93.3%
Simplified93.3%
Final simplification88.0%
(FPCore (w l) :precision binary64 (if (<= w 350000000.0) (- l (* w (+ l (* w (* l -0.5))))) (/ l (+ (* w (+ (* w (+ 0.5 (* w 0.16666666666666666))) 1.0)) 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 350000000.0) {
tmp = l - (w * (l + (w * (l * -0.5))));
} else {
tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 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 <= 350000000.0d0) then
tmp = l - (w * (l + (w * (l * (-0.5d0)))))
else
tmp = l / ((w * ((w * (0.5d0 + (w * 0.16666666666666666d0))) + 1.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 350000000.0) {
tmp = l - (w * (l + (w * (l * -0.5))));
} else {
tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 350000000.0: tmp = l - (w * (l + (w * (l * -0.5)))) else: tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 350000000.0) tmp = Float64(l - Float64(w * Float64(l + Float64(w * Float64(l * -0.5))))); else tmp = Float64(l / Float64(Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * 0.16666666666666666))) + 1.0)) + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 350000000.0) tmp = l - (w * (l + (w * (l * -0.5)))); else tmp = l / ((w * ((w * (0.5 + (w * 0.16666666666666666))) + 1.0)) + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 350000000.0], N[(l - N[(w * N[(l + N[(w * N[(l * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(N[(w * N[(N[(w * N[(0.5 + N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 350000000:\\
\;\;\;\;\ell - w \cdot \left(\ell + w \cdot \left(\ell \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w \cdot \left(w \cdot \left(0.5 + w \cdot 0.16666666666666666\right) + 1\right) + 1}\\
\end{array}
\end{array}
if w < 3.5e8Initial 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 96.8%
Taylor expanded in w around 0 86.0%
associate-*r*86.0%
neg-mul-186.0%
distribute-rgt-out86.0%
metadata-eval86.0%
Simplified86.0%
if 3.5e8 < 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 w around 0 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in w around 0 86.6%
*-commutative86.6%
Simplified86.6%
Final simplification86.1%
(FPCore (w l) :precision binary64 (if (<= w 520000000.0) (- l (* w (+ l (* w (* l -0.5))))) (/ l (+ (* w (+ (* w 0.5) 1.0)) 1.0))))
double code(double w, double l) {
double tmp;
if (w <= 520000000.0) {
tmp = l - (w * (l + (w * (l * -0.5))));
} else {
tmp = l / ((w * ((w * 0.5) + 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 <= 520000000.0d0) then
tmp = l - (w * (l + (w * (l * (-0.5d0)))))
else
tmp = l / ((w * ((w * 0.5d0) + 1.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= 520000000.0) {
tmp = l - (w * (l + (w * (l * -0.5))));
} else {
tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= 520000000.0: tmp = l - (w * (l + (w * (l * -0.5)))) else: tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= 520000000.0) tmp = Float64(l - Float64(w * Float64(l + Float64(w * Float64(l * -0.5))))); else tmp = Float64(l / Float64(Float64(w * Float64(Float64(w * 0.5) + 1.0)) + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= 520000000.0) tmp = l - (w * (l + (w * (l * -0.5)))); else tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, 520000000.0], N[(l - N[(w * N[(l + N[(w * N[(l * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(N[(w * N[(N[(w * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq 520000000:\\
\;\;\;\;\ell - w \cdot \left(\ell + w \cdot \left(\ell \cdot -0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w \cdot \left(w \cdot 0.5 + 1\right) + 1}\\
\end{array}
\end{array}
if w < 5.2e8Initial 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 96.8%
Taylor expanded in w around 0 86.0%
associate-*r*86.0%
neg-mul-186.0%
distribute-rgt-out86.0%
metadata-eval86.0%
Simplified86.0%
if 5.2e8 < 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 w around 0 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in w around 0 72.2%
*-commutative100.0%
Simplified72.2%
Final simplification83.5%
(FPCore (w l) :precision binary64 (if (<= w -650.0) (- l (* w l)) (/ l (+ (* w (+ (* w 0.5) 1.0)) 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -650.0) {
tmp = l - (w * l);
} else {
tmp = l / ((w * ((w * 0.5) + 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 <= (-650.0d0)) then
tmp = l - (w * l)
else
tmp = l / ((w * ((w * 0.5d0) + 1.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -650.0) {
tmp = l - (w * l);
} else {
tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -650.0: tmp = l - (w * l) else: tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -650.0) tmp = Float64(l - Float64(w * l)); else tmp = Float64(l / Float64(Float64(w * Float64(Float64(w * 0.5) + 1.0)) + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -650.0) tmp = l - (w * l); else tmp = l / ((w * ((w * 0.5) + 1.0)) + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -650.0], N[(l - N[(w * l), $MachinePrecision]), $MachinePrecision], N[(l / N[(N[(w * N[(N[(w * 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -650:\\
\;\;\;\;\ell - w \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w \cdot \left(w \cdot 0.5 + 1\right) + 1}\\
\end{array}
\end{array}
if w < -650Initial 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 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in w around 0 34.3%
mul-1-neg34.3%
unsub-neg34.3%
Simplified34.3%
if -650 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in w around 0 96.5%
Taylor expanded in l around 0 96.5%
Taylor expanded in w around 0 89.8%
*-commutative99.2%
Simplified89.8%
Final simplification75.7%
(FPCore (w l) :precision binary64 (if (<= w -0.62) (- l (* w l)) (/ l (+ w 1.0))))
double code(double w, double l) {
double tmp;
if (w <= -0.62) {
tmp = l - (w * l);
} else {
tmp = 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 <= (-0.62d0)) then
tmp = l - (w * l)
else
tmp = l / (w + 1.0d0)
end if
code = tmp
end function
public static double code(double w, double l) {
double tmp;
if (w <= -0.62) {
tmp = l - (w * l);
} else {
tmp = l / (w + 1.0);
}
return tmp;
}
def code(w, l): tmp = 0 if w <= -0.62: tmp = l - (w * l) else: tmp = l / (w + 1.0) return tmp
function code(w, l) tmp = 0.0 if (w <= -0.62) tmp = Float64(l - Float64(w * l)); else tmp = Float64(l / Float64(w + 1.0)); end return tmp end
function tmp_2 = code(w, l) tmp = 0.0; if (w <= -0.62) tmp = l - (w * l); else tmp = l / (w + 1.0); end tmp_2 = tmp; end
code[w_, l_] := If[LessEqual[w, -0.62], N[(l - N[(w * l), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.62:\\
\;\;\;\;\ell - w \cdot \ell\\
\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\
\end{array}
\end{array}
if w < -0.619999999999999996Initial 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 100.0%
Taylor expanded in l around 0 100.0%
Taylor expanded in w around 0 34.3%
mul-1-neg34.3%
unsub-neg34.3%
Simplified34.3%
if -0.619999999999999996 < w Initial program 99.1%
exp-neg99.1%
remove-double-neg99.1%
associate-*l/99.1%
*-lft-identity99.1%
remove-double-neg99.1%
Simplified99.1%
Taylor expanded in w around 0 96.5%
Taylor expanded in l around 0 96.5%
Taylor expanded in w around 0 84.6%
+-commutative98.8%
Simplified84.6%
Final simplification71.8%
(FPCore (w l) :precision binary64 (- l (* w l)))
double code(double w, double l) {
return l - (w * l);
}
real(8) function code(w, l)
real(8), intent (in) :: w
real(8), intent (in) :: l
code = l - (w * l)
end function
public static double code(double w, double l) {
return l - (w * l);
}
def code(w, l): return l - (w * l)
function code(w, l) return Float64(l - Float64(w * l)) end
function tmp = code(w, l) tmp = l - (w * l); end
code[w_, l_] := N[(l - N[(w * l), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\ell - w \cdot \ell
\end{array}
Initial program 99.4%
exp-neg99.4%
remove-double-neg99.4%
associate-*l/99.4%
*-lft-identity99.4%
remove-double-neg99.4%
Simplified99.4%
Taylor expanded in w around 0 97.4%
Taylor expanded in l around 0 97.4%
Taylor expanded in w around 0 63.4%
mul-1-neg63.4%
unsub-neg63.4%
Simplified63.4%
Final simplification63.4%
(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.4%
Taylor expanded in w around 0 56.1%
herbie shell --seed 2024113
(FPCore (w l)
:name "exp-w (used to crash)"
:precision binary64
(* (exp (- w)) (pow l (exp w))))