exp-w (used to crash)

Percentage Accurate: 99.4% → 99.3%
Time: 14.4s
Alternatives: 14
Speedup: 1.0×

Specification

?
\[\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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 99.4% accurate, 1.0× speedup?

\[\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}

Alternative 1: 99.3% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sqrt{e^{w}}\\ \frac{{\left({\ell}^{t\_0}\right)}^{t\_0}}{e^{w}} \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (let* ((t_0 (sqrt (exp w)))) (/ (pow (pow l t_0) t_0) (exp w))))
double code(double w, double l) {
	double t_0 = sqrt(exp(w));
	return pow(pow(l, t_0), t_0) / exp(w);
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: t_0
    t_0 = sqrt(exp(w))
    code = ((l ** t_0) ** t_0) / exp(w)
end function
public static double code(double w, double l) {
	double t_0 = Math.sqrt(Math.exp(w));
	return Math.pow(Math.pow(l, t_0), t_0) / Math.exp(w);
}
def code(w, l):
	t_0 = math.sqrt(math.exp(w))
	return math.pow(math.pow(l, t_0), t_0) / math.exp(w)
function code(w, l)
	t_0 = sqrt(exp(w))
	return Float64(((l ^ t_0) ^ t_0) / exp(w))
end
function tmp = code(w, l)
	t_0 = sqrt(exp(w));
	tmp = ((l ^ t_0) ^ t_0) / exp(w);
end
code[w_, l_] := Block[{t$95$0 = N[Sqrt[N[Exp[w], $MachinePrecision]], $MachinePrecision]}, N[(N[Power[N[Power[l, t$95$0], $MachinePrecision], t$95$0], $MachinePrecision] / N[Exp[w], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sqrt{e^{w}}\\
\frac{{\left({\ell}^{t\_0}\right)}^{t\_0}}{e^{w}}
\end{array}
\end{array}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Step-by-step derivation
    1. exp-neg99.7%

      \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. remove-double-neg99.7%

      \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. associate-*l/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
    4. *-lft-identity99.7%

      \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
    5. remove-double-neg99.7%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
  4. Add Preprocessing
  5. Taylor expanded in l around inf 94.8%

    \[\leadsto \frac{\color{blue}{e^{-1 \cdot \left(e^{w} \cdot \log \left(\frac{1}{\ell}\right)\right)}}}{e^{w}} \]
  6. Step-by-step derivation
    1. mul-1-neg94.8%

      \[\leadsto \frac{e^{\color{blue}{-e^{w} \cdot \log \left(\frac{1}{\ell}\right)}}}{e^{w}} \]
    2. *-commutative94.8%

      \[\leadsto \frac{e^{-\color{blue}{\log \left(\frac{1}{\ell}\right) \cdot e^{w}}}}{e^{w}} \]
    3. distribute-lft-neg-in94.8%

      \[\leadsto \frac{e^{\color{blue}{\left(-\log \left(\frac{1}{\ell}\right)\right) \cdot e^{w}}}}{e^{w}} \]
    4. log-rec94.8%

      \[\leadsto \frac{e^{\color{blue}{\log \left(\frac{1}{\frac{1}{\ell}}\right)} \cdot e^{w}}}{e^{w}} \]
    5. remove-double-div94.8%

      \[\leadsto \frac{e^{\log \color{blue}{\ell} \cdot e^{w}}}{e^{w}} \]
  7. Simplified94.8%

    \[\leadsto \frac{\color{blue}{e^{\log \ell \cdot e^{w}}}}{e^{w}} \]
  8. Step-by-step derivation
    1. pow-to-exp99.7%

      \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{w}} \]
    2. add-sqr-sqrt99.6%

      \[\leadsto \frac{{\ell}^{\color{blue}{\left(\sqrt{e^{w}} \cdot \sqrt{e^{w}}\right)}}}{e^{w}} \]
    3. pow-unpow99.7%

      \[\leadsto \frac{\color{blue}{{\left({\ell}^{\left(\sqrt{e^{w}}\right)}\right)}^{\left(\sqrt{e^{w}}\right)}}}{e^{w}} \]
  9. Applied egg-rr99.7%

    \[\leadsto \frac{\color{blue}{{\left({\ell}^{\left(\sqrt{e^{w}}\right)}\right)}^{\left(\sqrt{e^{w}}\right)}}}{e^{w}} \]
  10. Add Preprocessing

Alternative 2: 99.4% accurate, 1.0× speedup?

\[\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}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 3: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{{\ell}^{\left(e^{w}\right)}}{e^{w}} \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}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Step-by-step derivation
    1. exp-neg99.7%

      \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. remove-double-neg99.7%

      \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. associate-*l/99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
    4. *-lft-identity99.7%

      \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
    5. remove-double-neg99.7%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
  3. Simplified99.7%

    \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
  4. Add Preprocessing
  5. Add Preprocessing

Alternative 4: 97.6% accurate, 2.9× speedup?

\[\begin{array}{l} \\ \ell \cdot e^{-w} \end{array} \]
(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(Float64(-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}

\\
\ell \cdot e^{-w}
\end{array}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt44.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
    2. sqrt-unprod82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
    4. sqrt-unprod38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
    5. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
    6. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
    7. sqrt-unprod81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
    8. add-sqr-sqrt38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
    9. sqrt-unprod66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
    10. sqr-neg66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
    11. sqrt-unprod28.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
    12. add-sqr-sqrt56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
    13. pow156.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
    14. exp-neg56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
    16. pow-prod-up97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
    17. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
    18. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
    19. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
  4. Applied egg-rr97.9%

    \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
  5. Taylor expanded in w around inf 97.9%

    \[\leadsto \color{blue}{\ell \cdot e^{-w}} \]
  6. Add Preprocessing

Alternative 5: 97.6% accurate, 3.0× speedup?

\[\begin{array}{l} \\ \frac{\ell}{e^{w}} \end{array} \]
(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}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt44.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
    2. sqrt-unprod82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
    4. sqrt-unprod38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
    5. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
    6. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
    7. sqrt-unprod81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
    8. add-sqr-sqrt38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
    9. sqrt-unprod66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
    10. sqr-neg66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
    11. sqrt-unprod28.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
    12. add-sqr-sqrt56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
    13. pow156.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
    14. exp-neg56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
    16. pow-prod-up97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
    17. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
    18. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
    19. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
  4. Applied egg-rr97.9%

    \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
  5. Taylor expanded in w around inf 97.9%

    \[\leadsto \color{blue}{\ell \cdot e^{-w}} \]
  6. Step-by-step derivation
    1. exp-neg97.9%

      \[\leadsto \ell \cdot \color{blue}{\frac{1}{e^{w}}} \]
    2. associate-*r/97.9%

      \[\leadsto \color{blue}{\frac{\ell \cdot 1}{e^{w}}} \]
    3. *-rgt-identity97.9%

      \[\leadsto \frac{\color{blue}{\ell}}{e^{w}} \]
    4. rem-exp-log93.0%

      \[\leadsto \frac{\color{blue}{e^{\log \ell}}}{e^{w}} \]
    5. rem-exp-log97.9%

      \[\leadsto \frac{\color{blue}{\ell}}{e^{w}} \]
  7. Simplified97.9%

    \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
  8. Add Preprocessing

Alternative 6: 84.6% accurate, 15.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 1.8e-6)
   (* l (+ 1.0 (* w (+ (* w (+ 0.5 (* w -0.16666666666666666))) -1.0))))
   (/ l (+ w 1.0))))
double code(double w, double l) {
	double tmp;
	if (w <= 1.8e-6) {
		tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	} 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 <= 1.8d-6) then
        tmp = l * (1.0d0 + (w * ((w * (0.5d0 + (w * (-0.16666666666666666d0)))) + (-1.0d0))))
    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.8e-6) {
		tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	} else {
		tmp = l / (w + 1.0);
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 1.8e-6:
		tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)))
	else:
		tmp = l / (w + 1.0)
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 1.8e-6)
		tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))) + -1.0))));
	else
		tmp = Float64(l / Float64(w + 1.0));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 1.8e-6)
		tmp = l * (1.0 + (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	else
		tmp = l / (w + 1.0);
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l * N[(1.0 + N[(w * N[(N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < 1.79999999999999992e-6

    1. Initial program 99.7%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod33.8%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow167.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.1%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 90.5%

      \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(0.5 + -0.16666666666666666 \cdot w\right) - 1\right)\right)} \cdot \left(\ell \cdot 1\right) \]

    if 1.79999999999999992e-6 < w

    1. Initial program 99.5%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. exp-neg99.5%

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. remove-double-neg99.5%

        \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
      4. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
      5. remove-double-neg99.5%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
    4. Add Preprocessing
    5. Taylor expanded in w around 0 98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{1 + w}} \]
    6. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    7. Simplified98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow11.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    9. Applied egg-rr49.1%

      \[\leadsto \frac{\color{blue}{\ell \cdot 1}}{w + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.6% accurate, 15.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 1.9 \cdot 10^{-6}:\\ \;\;\;\;\ell + \ell \cdot \left(w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 1.9e-6)
   (+ l (* l (* w (+ (* w (+ 0.5 (* w -0.16666666666666666))) -1.0))))
   (/ l (+ w 1.0))))
double code(double w, double l) {
	double tmp;
	if (w <= 1.9e-6) {
		tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	} 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 <= 1.9d-6) then
        tmp = l + (l * (w * ((w * (0.5d0 + (w * (-0.16666666666666666d0)))) + (-1.0d0))))
    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.9e-6) {
		tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	} else {
		tmp = l / (w + 1.0);
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 1.9e-6:
		tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)))
	else:
		tmp = l / (w + 1.0)
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 1.9e-6)
		tmp = Float64(l + Float64(l * Float64(w * Float64(Float64(w * Float64(0.5 + Float64(w * -0.16666666666666666))) + -1.0))));
	else
		tmp = Float64(l / Float64(w + 1.0));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 1.9e-6)
		tmp = l + (l * (w * ((w * (0.5 + (w * -0.16666666666666666))) + -1.0)));
	else
		tmp = l / (w + 1.0);
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 1.9e-6], N[(l + N[(l * N[(w * N[(N[(w * N[(0.5 + N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;\ell + \ell \cdot \left(w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < 1.9e-6

    1. Initial program 99.7%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod33.8%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow167.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.1%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 88.0%

      \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
    6. Taylor expanded in l around 0 90.5%

      \[\leadsto \ell + \color{blue}{\ell \cdot \left(w \cdot \left(w \cdot \left(0.5 + -0.16666666666666666 \cdot w\right) - 1\right)\right)} \]

    if 1.9e-6 < w

    1. Initial program 99.5%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. exp-neg99.5%

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. remove-double-neg99.5%

        \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
      4. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
      5. remove-double-neg99.5%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
    4. Add Preprocessing
    5. Taylor expanded in w around 0 98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{1 + w}} \]
    6. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    7. Simplified98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow11.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    9. Applied egg-rr49.1%

      \[\leadsto \frac{\color{blue}{\ell \cdot 1}}{w + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 1.9 \cdot 10^{-6}:\\ \;\;\;\;\ell + \ell \cdot \left(w \cdot \left(w \cdot \left(0.5 + w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.4% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot 0.5 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 1.75e-6) (* l (+ 1.0 (* w (+ (* w 0.5) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
	double tmp;
	if (w <= 1.75e-6) {
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	} 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 <= 1.75d-6) then
        tmp = l * (1.0d0 + (w * ((w * 0.5d0) + (-1.0d0))))
    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.75e-6) {
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	} else {
		tmp = l / (w + 1.0);
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 1.75e-6:
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)))
	else:
		tmp = l / (w + 1.0)
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 1.75e-6)
		tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * 0.5) + -1.0))));
	else
		tmp = Float64(l / Float64(w + 1.0));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 1.75e-6)
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	else
		tmp = l / (w + 1.0);
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 1.75e-6], N[(l * N[(1.0 + N[(w * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.75 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot 0.5 + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < 1.74999999999999997e-6

    1. Initial program 99.7%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod33.8%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow167.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.1%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 86.1%

      \[\leadsto \color{blue}{\left(1 + w \cdot \left(0.5 \cdot w - 1\right)\right)} \cdot \left(\ell \cdot 1\right) \]

    if 1.74999999999999997e-6 < w

    1. Initial program 99.5%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. exp-neg99.5%

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. remove-double-neg99.5%

        \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
      4. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
      5. remove-double-neg99.5%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
    4. Add Preprocessing
    5. Taylor expanded in w around 0 98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{1 + w}} \]
    6. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    7. Simplified98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow11.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    9. Applied egg-rr49.1%

      \[\leadsto \frac{\color{blue}{\ell \cdot 1}}{w + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification80.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 1.75 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot 0.5 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 78.0% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell + w \cdot \left(\ell \cdot \left(w \cdot 0.5 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 1.8e-6) (+ l (* w (* l (+ (* w 0.5) -1.0)))) (/ l (+ w 1.0))))
double code(double w, double l) {
	double tmp;
	if (w <= 1.8e-6) {
		tmp = l + (w * (l * ((w * 0.5) + -1.0)));
	} 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 <= 1.8d-6) then
        tmp = l + (w * (l * ((w * 0.5d0) + (-1.0d0))))
    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.8e-6) {
		tmp = l + (w * (l * ((w * 0.5) + -1.0)));
	} else {
		tmp = l / (w + 1.0);
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 1.8e-6:
		tmp = l + (w * (l * ((w * 0.5) + -1.0)))
	else:
		tmp = l / (w + 1.0)
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 1.8e-6)
		tmp = Float64(l + Float64(w * Float64(l * Float64(Float64(w * 0.5) + -1.0))));
	else
		tmp = Float64(l / Float64(w + 1.0));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 1.8e-6)
		tmp = l + (w * (l * ((w * 0.5) + -1.0)));
	else
		tmp = l / (w + 1.0);
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l + N[(w * N[(l * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell + w \cdot \left(\ell \cdot \left(w \cdot 0.5 + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < 1.79999999999999992e-6

    1. Initial program 99.7%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod33.8%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow167.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.1%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 88.0%

      \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
    6. Taylor expanded in w around 0 82.2%

      \[\leadsto \ell + \color{blue}{w \cdot \left(-1 \cdot \ell + 0.5 \cdot \left(\ell \cdot w\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutative82.2%

        \[\leadsto \ell + w \cdot \left(\color{blue}{\ell \cdot -1} + 0.5 \cdot \left(\ell \cdot w\right)\right) \]
      2. associate-*r*82.2%

        \[\leadsto \ell + w \cdot \left(\ell \cdot -1 + \color{blue}{\left(0.5 \cdot \ell\right) \cdot w}\right) \]
      3. *-commutative82.2%

        \[\leadsto \ell + w \cdot \left(\ell \cdot -1 + \color{blue}{\left(\ell \cdot 0.5\right)} \cdot w\right) \]
      4. associate-*r*82.2%

        \[\leadsto \ell + w \cdot \left(\ell \cdot -1 + \color{blue}{\ell \cdot \left(0.5 \cdot w\right)}\right) \]
      5. distribute-lft-out82.2%

        \[\leadsto \ell + w \cdot \color{blue}{\left(\ell \cdot \left(-1 + 0.5 \cdot w\right)\right)} \]
      6. *-commutative82.2%

        \[\leadsto \ell + w \cdot \left(\ell \cdot \left(-1 + \color{blue}{w \cdot 0.5}\right)\right) \]
    8. Simplified82.2%

      \[\leadsto \ell + \color{blue}{w \cdot \left(\ell \cdot \left(-1 + w \cdot 0.5\right)\right)} \]

    if 1.79999999999999992e-6 < w

    1. Initial program 99.5%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. exp-neg99.5%

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. remove-double-neg99.5%

        \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
      4. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
      5. remove-double-neg99.5%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
    4. Add Preprocessing
    5. Taylor expanded in w around 0 98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{1 + w}} \]
    6. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    7. Simplified98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow11.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    9. Applied egg-rr49.1%

      \[\leadsto \frac{\color{blue}{\ell \cdot 1}}{w + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification76.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell + w \cdot \left(\ell \cdot \left(w \cdot 0.5 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 70.9% accurate, 25.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(-1 + \left(2 - w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 1.8e-6) (* l (+ -1.0 (- 2.0 w))) (/ l (+ w 1.0))))
double code(double w, double l) {
	double tmp;
	if (w <= 1.8e-6) {
		tmp = l * (-1.0 + (2.0 - w));
	} 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 <= 1.8d-6) then
        tmp = l * ((-1.0d0) + (2.0d0 - 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.8e-6) {
		tmp = l * (-1.0 + (2.0 - w));
	} else {
		tmp = l / (w + 1.0);
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 1.8e-6:
		tmp = l * (-1.0 + (2.0 - w))
	else:
		tmp = l / (w + 1.0)
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 1.8e-6)
		tmp = Float64(l * Float64(-1.0 + Float64(2.0 - w)));
	else
		tmp = Float64(l / Float64(w + 1.0));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 1.8e-6)
		tmp = l * (-1.0 + (2.0 - w));
	else
		tmp = l / (w + 1.0);
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 1.8e-6], N[(l * N[(-1.0 + N[(2.0 - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(w + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\
\;\;\;\;\ell \cdot \left(-1 + \left(2 - w\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{w + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < 1.79999999999999992e-6

    1. Initial program 99.7%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt34.3%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg79.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt45.2%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg79.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod33.8%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow167.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow67.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.1%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 88.0%

      \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
    6. Taylor expanded in w around 0 73.6%

      \[\leadsto \color{blue}{\ell + -1 \cdot \left(\ell \cdot w\right)} \]
    7. Step-by-step derivation
      1. *-rgt-identity73.6%

        \[\leadsto \color{blue}{\ell \cdot 1} + -1 \cdot \left(\ell \cdot w\right) \]
      2. neg-mul-173.6%

        \[\leadsto \ell \cdot 1 + \color{blue}{\left(-\ell \cdot w\right)} \]
      3. distribute-rgt-neg-in73.6%

        \[\leadsto \ell \cdot 1 + \color{blue}{\ell \cdot \left(-w\right)} \]
      4. distribute-lft-out73.6%

        \[\leadsto \color{blue}{\ell \cdot \left(1 + \left(-w\right)\right)} \]
      5. sub-neg73.6%

        \[\leadsto \ell \cdot \color{blue}{\left(1 - w\right)} \]
    8. Simplified73.6%

      \[\leadsto \color{blue}{\ell \cdot \left(1 - w\right)} \]
    9. Step-by-step derivation
      1. expm1-log1p-u73.6%

        \[\leadsto \ell \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - w\right)\right)} \]
    10. Applied egg-rr73.6%

      \[\leadsto \ell \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - w\right)\right)} \]
    11. Step-by-step derivation
      1. expm1-undefine73.6%

        \[\leadsto \ell \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(1 - w\right)} - 1\right)} \]
      2. sub-neg73.6%

        \[\leadsto \ell \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(1 - w\right)} + \left(-1\right)\right)} \]
      3. log1p-undefine73.6%

        \[\leadsto \ell \cdot \left(e^{\color{blue}{\log \left(1 + \left(1 - w\right)\right)}} + \left(-1\right)\right) \]
      4. rem-exp-log73.6%

        \[\leadsto \ell \cdot \left(\color{blue}{\left(1 + \left(1 - w\right)\right)} + \left(-1\right)\right) \]
      5. associate-+r-73.6%

        \[\leadsto \ell \cdot \left(\color{blue}{\left(\left(1 + 1\right) - w\right)} + \left(-1\right)\right) \]
      6. metadata-eval73.6%

        \[\leadsto \ell \cdot \left(\left(\color{blue}{2} - w\right) + \left(-1\right)\right) \]
      7. metadata-eval73.6%

        \[\leadsto \ell \cdot \left(\left(2 - w\right) + \color{blue}{-1}\right) \]
    12. Simplified73.6%

      \[\leadsto \ell \cdot \color{blue}{\left(\left(2 - w\right) + -1\right)} \]

    if 1.79999999999999992e-6 < w

    1. Initial program 99.5%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. exp-neg99.5%

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. remove-double-neg99.5%

        \[\leadsto \frac{1}{e^{\color{blue}{-\left(-w\right)}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. associate-*l/99.5%

        \[\leadsto \color{blue}{\frac{1 \cdot {\ell}^{\left(e^{w}\right)}}{e^{-\left(-w\right)}}} \]
      4. *-lft-identity99.5%

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{-\left(-w\right)}} \]
      5. remove-double-neg99.5%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{\color{blue}{w}}} \]
    3. Simplified99.5%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{e^{w}}} \]
    4. Add Preprocessing
    5. Taylor expanded in w around 0 98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{1 + w}} \]
    6. Step-by-step derivation
      1. +-commutative98.8%

        \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    7. Simplified98.8%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Step-by-step derivation
      1. add-sqr-sqrt99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg99.5%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod96.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow11.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow1.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval96.7%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    9. Applied egg-rr49.1%

      \[\leadsto \frac{\color{blue}{\ell \cdot 1}}{w + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 1.8 \cdot 10^{-6}:\\ \;\;\;\;\ell \cdot \left(-1 + \left(2 - w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 64.2% accurate, 33.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -0.38:\\ \;\;\;\;w \cdot \left(-\ell\right)\\ \mathbf{else}:\\ \;\;\;\;\ell\\ \end{array} \end{array} \]
(FPCore (w l) :precision binary64 (if (<= w -0.38) (* w (- l)) l))
double code(double w, double l) {
	double tmp;
	if (w <= -0.38) {
		tmp = w * -l;
	} 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.38d0)) then
        tmp = w * -l
    else
        tmp = l
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= -0.38) {
		tmp = w * -l;
	} else {
		tmp = l;
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= -0.38:
		tmp = w * -l
	else:
		tmp = l
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= -0.38)
		tmp = Float64(w * Float64(-l));
	else
		tmp = l;
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= -0.38)
		tmp = w * -l;
	else
		tmp = l;
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, -0.38], N[(w * (-l)), $MachinePrecision], l]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -0.38:\\
\;\;\;\;w \cdot \left(-\ell\right)\\

\mathbf{else}:\\
\;\;\;\;\ell\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if w < -0.38

    1. Initial program 100.0%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
      2. sqrt-unprod37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
      3. sqr-neg37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
      4. sqrt-unprod37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
      5. add-sqr-sqrt37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
      6. add-sqr-sqrt37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
      7. sqrt-unprod37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
      8. add-sqr-sqrt37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
      10. sqr-neg37.4%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
      11. sqrt-unprod0.0%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
      12. add-sqr-sqrt0.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
      13. pow10.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
      14. exp-neg0.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow0.1%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
      16. pow-prod-up98.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
      17. metadata-eval98.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
      18. metadata-eval98.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
      19. metadata-eval98.6%

        \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
    4. Applied egg-rr98.6%

      \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
    5. Taylor expanded in w around 0 65.9%

      \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
    6. Taylor expanded in w around 0 19.8%

      \[\leadsto \color{blue}{\ell + -1 \cdot \left(\ell \cdot w\right)} \]
    7. Step-by-step derivation
      1. *-rgt-identity19.8%

        \[\leadsto \color{blue}{\ell \cdot 1} + -1 \cdot \left(\ell \cdot w\right) \]
      2. neg-mul-119.8%

        \[\leadsto \ell \cdot 1 + \color{blue}{\left(-\ell \cdot w\right)} \]
      3. distribute-rgt-neg-in19.8%

        \[\leadsto \ell \cdot 1 + \color{blue}{\ell \cdot \left(-w\right)} \]
      4. distribute-lft-out19.8%

        \[\leadsto \color{blue}{\ell \cdot \left(1 + \left(-w\right)\right)} \]
      5. sub-neg19.8%

        \[\leadsto \ell \cdot \color{blue}{\left(1 - w\right)} \]
    8. Simplified19.8%

      \[\leadsto \color{blue}{\ell \cdot \left(1 - w\right)} \]
    9. Taylor expanded in w around inf 19.8%

      \[\leadsto \color{blue}{-1 \cdot \left(\ell \cdot w\right)} \]
    10. Step-by-step derivation
      1. mul-1-neg19.8%

        \[\leadsto \color{blue}{-\ell \cdot w} \]
      2. distribute-lft-neg-out19.8%

        \[\leadsto \color{blue}{\left(-\ell\right) \cdot w} \]
      3. *-commutative19.8%

        \[\leadsto \color{blue}{w \cdot \left(-\ell\right)} \]
    11. Simplified19.8%

      \[\leadsto \color{blue}{w \cdot \left(-\ell\right)} \]

    if -0.38 < w

    1. Initial program 99.6%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in w around 0 78.2%

      \[\leadsto \color{blue}{\ell} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 63.9% accurate, 43.6× speedup?

\[\begin{array}{l} \\ \ell \cdot \left(-1 + \left(2 - w\right)\right) \end{array} \]
(FPCore (w l) :precision binary64 (* l (+ -1.0 (- 2.0 w))))
double code(double w, double l) {
	return l * (-1.0 + (2.0 - w));
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    code = l * ((-1.0d0) + (2.0d0 - w))
end function
public static double code(double w, double l) {
	return l * (-1.0 + (2.0 - w));
}
def code(w, l):
	return l * (-1.0 + (2.0 - w))
function code(w, l)
	return Float64(l * Float64(-1.0 + Float64(2.0 - w)))
end
function tmp = code(w, l)
	tmp = l * (-1.0 + (2.0 - w));
end
code[w_, l_] := N[(l * N[(-1.0 + N[(2.0 - w), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\ell \cdot \left(-1 + \left(2 - w\right)\right)
\end{array}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt44.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
    2. sqrt-unprod82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
    4. sqrt-unprod38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
    5. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
    6. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
    7. sqrt-unprod81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
    8. add-sqr-sqrt38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
    9. sqrt-unprod66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
    10. sqr-neg66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
    11. sqrt-unprod28.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
    12. add-sqr-sqrt56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
    13. pow156.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
    14. exp-neg56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
    16. pow-prod-up97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
    17. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
    18. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
    19. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
  4. Applied egg-rr97.9%

    \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
  5. Taylor expanded in w around 0 74.5%

    \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
  6. Taylor expanded in w around 0 62.6%

    \[\leadsto \color{blue}{\ell + -1 \cdot \left(\ell \cdot w\right)} \]
  7. Step-by-step derivation
    1. *-rgt-identity62.6%

      \[\leadsto \color{blue}{\ell \cdot 1} + -1 \cdot \left(\ell \cdot w\right) \]
    2. neg-mul-162.6%

      \[\leadsto \ell \cdot 1 + \color{blue}{\left(-\ell \cdot w\right)} \]
    3. distribute-rgt-neg-in62.6%

      \[\leadsto \ell \cdot 1 + \color{blue}{\ell \cdot \left(-w\right)} \]
    4. distribute-lft-out62.6%

      \[\leadsto \color{blue}{\ell \cdot \left(1 + \left(-w\right)\right)} \]
    5. sub-neg62.6%

      \[\leadsto \ell \cdot \color{blue}{\left(1 - w\right)} \]
  8. Simplified62.6%

    \[\leadsto \color{blue}{\ell \cdot \left(1 - w\right)} \]
  9. Step-by-step derivation
    1. expm1-log1p-u62.1%

      \[\leadsto \ell \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - w\right)\right)} \]
  10. Applied egg-rr62.1%

    \[\leadsto \ell \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - w\right)\right)} \]
  11. Step-by-step derivation
    1. expm1-undefine62.1%

      \[\leadsto \ell \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(1 - w\right)} - 1\right)} \]
    2. sub-neg62.1%

      \[\leadsto \ell \cdot \color{blue}{\left(e^{\mathsf{log1p}\left(1 - w\right)} + \left(-1\right)\right)} \]
    3. log1p-undefine62.1%

      \[\leadsto \ell \cdot \left(e^{\color{blue}{\log \left(1 + \left(1 - w\right)\right)}} + \left(-1\right)\right) \]
    4. rem-exp-log62.6%

      \[\leadsto \ell \cdot \left(\color{blue}{\left(1 + \left(1 - w\right)\right)} + \left(-1\right)\right) \]
    5. associate-+r-62.6%

      \[\leadsto \ell \cdot \left(\color{blue}{\left(\left(1 + 1\right) - w\right)} + \left(-1\right)\right) \]
    6. metadata-eval62.6%

      \[\leadsto \ell \cdot \left(\left(\color{blue}{2} - w\right) + \left(-1\right)\right) \]
    7. metadata-eval62.6%

      \[\leadsto \ell \cdot \left(\left(2 - w\right) + \color{blue}{-1}\right) \]
  12. Simplified62.6%

    \[\leadsto \ell \cdot \color{blue}{\left(\left(2 - w\right) + -1\right)} \]
  13. Final simplification62.6%

    \[\leadsto \ell \cdot \left(-1 + \left(2 - w\right)\right) \]
  14. Add Preprocessing

Alternative 13: 63.9% accurate, 61.0× speedup?

\[\begin{array}{l} \\ \ell \cdot \left(1 - w\right) \end{array} \]
(FPCore (w l) :precision binary64 (* l (- 1.0 w)))
double code(double w, double l) {
	return l * (1.0 - w);
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    code = l * (1.0d0 - w)
end function
public static double code(double w, double l) {
	return l * (1.0 - w);
}
def code(w, l):
	return l * (1.0 - w)
function code(w, l)
	return Float64(l * Float64(1.0 - w))
end
function tmp = code(w, l)
	tmp = l * (1.0 - w);
end
code[w_, l_] := N[(l * N[(1.0 - w), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\ell \cdot \left(1 - w\right)
\end{array}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt44.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}}\right)} \]
    2. sqrt-unprod82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg82.7%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\sqrt{\color{blue}{\left(-w\right) \cdot \left(-w\right)}}}\right)} \]
    4. sqrt-unprod38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}}\right)} \]
    5. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{-w}}\right)} \]
    6. add-sqr-sqrt81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w}} \cdot \sqrt{e^{-w}}\right)}} \]
    7. sqrt-unprod81.8%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{\left(\sqrt{e^{-w} \cdot e^{-w}}\right)}} \]
    8. add-sqr-sqrt38.0%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
    9. sqrt-unprod66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{\left(-w\right) \cdot \left(-w\right)}}} \cdot e^{-w}}\right)} \]
    10. sqr-neg66.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\sqrt{\color{blue}{w \cdot w}}} \cdot e^{-w}}\right)} \]
    11. sqrt-unprod28.6%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{w} \cdot \sqrt{w}}} \cdot e^{-w}}\right)} \]
    12. add-sqr-sqrt56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{w}} \cdot e^{-w}}\right)} \]
    13. pow156.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{1}} \cdot e^{-w}}\right)} \]
    14. exp-neg56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow56.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{{\left(e^{w}\right)}^{-1}}}\right)} \]
    16. pow-prod-up97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{{\left(e^{w}\right)}^{\left(1 + -1\right)}}}\right)} \]
    17. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{\color{blue}{0}}}\right)} \]
    18. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{\color{blue}{1}}\right)} \]
    19. metadata-eval97.9%

      \[\leadsto e^{-w} \cdot {\ell}^{\color{blue}{1}} \]
  4. Applied egg-rr97.9%

    \[\leadsto e^{-w} \cdot \color{blue}{\left(\ell \cdot 1\right)} \]
  5. Taylor expanded in w around 0 74.5%

    \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \ell + w \cdot \left(-0.16666666666666666 \cdot \left(\ell \cdot w\right) + 0.5 \cdot \ell\right)\right)} \]
  6. Taylor expanded in w around 0 62.6%

    \[\leadsto \color{blue}{\ell + -1 \cdot \left(\ell \cdot w\right)} \]
  7. Step-by-step derivation
    1. *-rgt-identity62.6%

      \[\leadsto \color{blue}{\ell \cdot 1} + -1 \cdot \left(\ell \cdot w\right) \]
    2. neg-mul-162.6%

      \[\leadsto \ell \cdot 1 + \color{blue}{\left(-\ell \cdot w\right)} \]
    3. distribute-rgt-neg-in62.6%

      \[\leadsto \ell \cdot 1 + \color{blue}{\ell \cdot \left(-w\right)} \]
    4. distribute-lft-out62.6%

      \[\leadsto \color{blue}{\ell \cdot \left(1 + \left(-w\right)\right)} \]
    5. sub-neg62.6%

      \[\leadsto \ell \cdot \color{blue}{\left(1 - w\right)} \]
  8. Simplified62.6%

    \[\leadsto \color{blue}{\ell \cdot \left(1 - w\right)} \]
  9. Add Preprocessing

Alternative 14: 57.2% accurate, 305.0× speedup?

\[\begin{array}{l} \\ \ell \end{array} \]
(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}
Derivation
  1. Initial program 99.7%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in w around 0 58.7%

    \[\leadsto \color{blue}{\ell} \]
  4. Add Preprocessing

Reproduce

?
herbie shell --seed 2024130 
(FPCore (w l)
  :name "exp-w (used to crash)"
  :precision binary64
  (* (exp (- w)) (pow l (exp w))))