exp-w (used to crash)

Percentage Accurate: 99.4% → 99.4%
Time: 19.6s
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.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.1%

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

Alternative 2: 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.1%

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

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

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

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

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

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

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

Alternative 3: 97.7% accurate, 2.9× speedup?

\[\begin{array}{l} \\ e^{-w} \cdot \ell \end{array} \]
(FPCore (w l) :precision binary64 (* (exp (- w)) l))
double code(double w, double l) {
	return exp(-w) * l;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    code = exp(-w) * l
end function
public static double code(double w, double l) {
	return Math.exp(-w) * l;
}
def code(w, l):
	return math.exp(-w) * l
function code(w, l)
	return Float64(exp(Float64(-w)) * l)
end
function tmp = code(w, l)
	tmp = exp(-w) * l;
end
code[w_, l_] := N[(N[Exp[(-w)], $MachinePrecision] * l), $MachinePrecision]
\begin{array}{l}

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

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg88.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-sqrt87.5%

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

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

      \[\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-unprod62.1%

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

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

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

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow53.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-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. Final simplification98.1%

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

Alternative 4: 97.7% 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.1%

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg88.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-sqrt87.5%

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

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

      \[\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-unprod62.1%

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

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

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

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow53.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-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 inf 98.1%

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

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

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

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

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

Alternative 5: 88.0% accurate, 15.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 0.35:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 0.35)
   (* l (+ 1.0 (* w (+ (* w (* w -0.16666666666666666)) -1.0))))
   (/ l (+ 1.0 (* w (+ 1.0 (* w (+ 0.5 (* w 0.16666666666666666)))))))))
double code(double w, double l) {
	double tmp;
	if (w <= 0.35) {
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= 0.35d0) then
        tmp = l * (1.0d0 + (w * ((w * (w * (-0.16666666666666666d0))) + (-1.0d0))))
    else
        tmp = l / (1.0d0 + (w * (1.0d0 + (w * (0.5d0 + (w * 0.16666666666666666d0))))))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= 0.35) {
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 0.35:
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)))
	else:
		tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 0.35)
		tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * Float64(w * -0.16666666666666666)) + -1.0))));
	else
		tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * Float64(0.5 + Float64(w * 0.16666666666666666)))))));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 0.35)
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	else
		tmp = l / (1.0 + (w * (1.0 + (w * (0.5 + (w * 0.16666666666666666))))));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 0.35], N[(l * N[(1.0 + N[(w * N[(N[(w * N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * N[(0.5 + N[(w * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.35:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right) + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)}\\


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow73.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.9%

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

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

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

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

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

      \[\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) \]
    6. Taylor expanded in w around inf 93.8%

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

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

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

    if 0.34999999999999998 < w

    1. Initial program 97.1%

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

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

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

        \[\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-sqrt94.4%

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

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

        \[\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.5%

        \[\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 81.9%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot \left(0.5 + 0.16666666666666666 \cdot w\right)\right)}} \]
    9. Step-by-step derivation
      1. *-commutative81.9%

        \[\leadsto \frac{\ell}{1 + w \cdot \left(1 + w \cdot \left(0.5 + \color{blue}{w \cdot 0.16666666666666666}\right)\right)} \]
    10. Simplified81.9%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot \left(0.5 + w \cdot 0.16666666666666666\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification90.5%

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

Alternative 6: 86.2% accurate, 16.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 0.78:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right) + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 0.78)
   (* l (+ 1.0 (* w (+ (* w (* w -0.16666666666666666)) -1.0))))
   (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
	double tmp;
	if (w <= 0.78) {
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= 0.78d0) then
        tmp = l * (1.0d0 + (w * ((w * (w * (-0.16666666666666666d0))) + (-1.0d0))))
    else
        tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= 0.78) {
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 0.78:
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)))
	else:
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 0.78)
		tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * Float64(w * -0.16666666666666666)) + -1.0))));
	else
		tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 0.78)
		tmp = l * (1.0 + (w * ((w * (w * -0.16666666666666666)) + -1.0)));
	else
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 0.78], N[(l * N[(1.0 + N[(w * N[(N[(w * N[(w * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.78:\\
\;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot \left(w \cdot -0.16666666666666666\right) + -1\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow73.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.9%

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

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

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

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

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

      \[\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) \]
    6. Taylor expanded in w around inf 93.8%

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

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

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

    if 0.78000000000000003 < w

    1. Initial program 97.1%

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

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

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

        \[\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-sqrt94.4%

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

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

        \[\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.5%

        \[\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 73.5%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + 0.5 \cdot w\right)}} \]
    9. Step-by-step derivation
      1. *-commutative73.5%

        \[\leadsto \frac{\ell}{1 + w \cdot \left(1 + \color{blue}{w \cdot 0.5}\right)} \]
    10. Simplified73.5%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot 0.5\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification88.2%

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

Alternative 7: 83.1% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -5 \cdot 10^{-14}:\\ \;\;\;\;\ell \cdot \left(1 + w \cdot \left(w \cdot 0.5 + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w -5e-14)
   (* l (+ 1.0 (* w (+ (* w 0.5) -1.0))))
   (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
	double tmp;
	if (w <= -5e-14) {
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= (-5d-14)) then
        tmp = l * (1.0d0 + (w * ((w * 0.5d0) + (-1.0d0))))
    else
        tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= -5e-14) {
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= -5e-14:
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)))
	else:
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= -5e-14)
		tmp = Float64(l * Float64(1.0 + Float64(w * Float64(Float64(w * 0.5) + -1.0))));
	else
		tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= -5e-14)
		tmp = l * (1.0 + (w * ((w * 0.5) + -1.0)));
	else
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, -5e-14], N[(l * N[(1.0 + N[(w * N[(N[(w * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\


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

    1. Initial program 99.8%

      \[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-unprod46.0%

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod46.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-neg46.0%

        \[\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-sqrt1.2%

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000002e-14 < w

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 90.3%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + 0.5 \cdot w\right)}} \]
    9. Step-by-step derivation
      1. *-commutative90.3%

        \[\leadsto \frac{\ell}{1 + w \cdot \left(1 + \color{blue}{w \cdot 0.5}\right)} \]
    10. Simplified90.3%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot 0.5\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification86.3%

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

Alternative 8: 80.5% accurate, 19.0× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\


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

    1. Initial program 99.8%

      \[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-unprod46.0%

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{e^{\color{blue}{\sqrt{-w} \cdot \sqrt{-w}}} \cdot e^{-w}}\right)} \]
      9. sqrt-unprod46.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-neg46.0%

        \[\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-sqrt1.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 56.4%

      \[\leadsto \color{blue}{\ell + w \cdot \left(-1 \cdot \left(w \cdot \left(-1 \cdot \ell + 0.5 \cdot \ell\right)\right) - \ell\right)} \]
    9. Step-by-step derivation
      1. sub-neg56.4%

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

        \[\leadsto \ell + \color{blue}{\left(w \cdot \left(-1 \cdot \left(w \cdot \left(-1 \cdot \ell + 0.5 \cdot \ell\right)\right)\right) + w \cdot \left(-\ell\right)\right)} \]
      3. mul-1-neg56.4%

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

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

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

        \[\leadsto \ell + \left(w \cdot \left(\left(-\color{blue}{\ell \cdot \left(-1 + 0.5\right)}\right) \cdot w\right) + w \cdot \left(-\ell\right)\right) \]
      7. metadata-eval56.4%

        \[\leadsto \ell + \left(w \cdot \left(\left(-\ell \cdot \color{blue}{-0.5}\right) \cdot w\right) + w \cdot \left(-\ell\right)\right) \]
      8. *-commutative56.4%

        \[\leadsto \ell + \left(w \cdot \left(\left(-\color{blue}{-0.5 \cdot \ell}\right) \cdot w\right) + w \cdot \left(-\ell\right)\right) \]
      9. distribute-lft-neg-in56.4%

        \[\leadsto \ell + \left(w \cdot \left(\color{blue}{\left(\left(--0.5\right) \cdot \ell\right)} \cdot w\right) + w \cdot \left(-\ell\right)\right) \]
      10. metadata-eval56.4%

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

        \[\leadsto \ell + \left(w \cdot \color{blue}{\left(0.5 \cdot \left(\ell \cdot w\right)\right)} + w \cdot \left(-\ell\right)\right) \]
      12. distribute-lft-in56.4%

        \[\leadsto \ell + \color{blue}{w \cdot \left(0.5 \cdot \left(\ell \cdot w\right) + \left(-\ell\right)\right)} \]
      13. unsub-neg56.4%

        \[\leadsto \ell + w \cdot \color{blue}{\left(0.5 \cdot \left(\ell \cdot w\right) - \ell\right)} \]
    10. Simplified56.4%

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

    if -2.00000000000000007e-10 < w

    1. Initial program 98.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 90.3%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + 0.5 \cdot w\right)}} \]
    9. Step-by-step derivation
      1. *-commutative90.3%

        \[\leadsto \frac{\ell}{1 + w \cdot \left(1 + \color{blue}{w \cdot 0.5}\right)} \]
    10. Simplified90.3%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot 0.5\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.8%

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

Alternative 9: 74.4% accurate, 19.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 0.92:\\ \;\;\;\;\ell - w \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w 0.92) (- l (* w l)) (/ l (+ 1.0 (* w (+ 1.0 (* w 0.5)))))))
double code(double w, double l) {
	double tmp;
	if (w <= 0.92) {
		tmp = l - (w * l);
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= 0.92d0) then
        tmp = l - (w * l)
    else
        tmp = l / (1.0d0 + (w * (1.0d0 + (w * 0.5d0))))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= 0.92) {
		tmp = l - (w * l);
	} else {
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 0.92:
		tmp = l - (w * l)
	else:
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 0.92)
		tmp = Float64(l - Float64(w * l));
	else
		tmp = Float64(l / Float64(1.0 + Float64(w * Float64(1.0 + Float64(w * 0.5)))));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 0.92)
		tmp = l - (w * l);
	else
		tmp = l / (1.0 + (w * (1.0 + (w * 0.5))));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 0.92], N[(l - N[(w * l), $MachinePrecision]), $MachinePrecision], N[(l / N[(1.0 + N[(w * N[(1.0 + N[(w * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.92:\\
\;\;\;\;\ell - w \cdot \ell\\

\mathbf{else}:\\
\;\;\;\;\frac{\ell}{1 + w \cdot \left(1 + w \cdot 0.5\right)}\\


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow73.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.9%

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

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

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

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

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

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

        \[\leadsto \ell + \color{blue}{\left(-\ell \cdot w\right)} \]
      2. distribute-lft-neg-out79.6%

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

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

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

    if 0.92000000000000004 < w

    1. Initial program 97.1%

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

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

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

        \[\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-sqrt94.4%

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

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

        \[\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.5%

        \[\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.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
    8. Taylor expanded in w around 0 73.5%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + 0.5 \cdot w\right)}} \]
    9. Step-by-step derivation
      1. *-commutative73.5%

        \[\leadsto \frac{\ell}{1 + w \cdot \left(1 + \color{blue}{w \cdot 0.5}\right)} \]
    10. Simplified73.5%

      \[\leadsto \frac{\ell}{\color{blue}{1 + w \cdot \left(1 + w \cdot 0.5\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification77.9%

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

Alternative 10: 68.9% accurate, 30.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.62:\\
\;\;\;\;\ell - w \cdot \ell\\

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


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

    1. Initial program 99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
      15. inv-pow73.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.9%

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

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

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

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

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

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

        \[\leadsto \ell + \color{blue}{\left(-\ell \cdot w\right)} \]
      2. distribute-lft-neg-out79.6%

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

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

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

    if 0.619999999999999996 < w

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Taylor expanded in w around inf 98.6%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{w}} \]
    9. Taylor expanded in w around 0 53.3%

      \[\leadsto \color{blue}{\frac{\ell}{w}} \]
    10. Step-by-step derivation
      1. clear-num53.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{w}{\ell}}} \]
      2. inv-pow53.4%

        \[\leadsto \color{blue}{{\left(\frac{w}{\ell}\right)}^{-1}} \]
    11. Applied egg-rr53.4%

      \[\leadsto \color{blue}{{\left(\frac{w}{\ell}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-153.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{w}{\ell}}} \]
    13. Simplified53.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \leq 0.62:\\ \;\;\;\;\ell - w \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{w}{\ell}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 63.2% accurate, 30.5× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.22:\\
\;\;\;\;\ell\\

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


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

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\ell} \]

    if 0.220000000000000001 < w

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Taylor expanded in w around inf 98.6%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{w}} \]
    9. Taylor expanded in w around 0 53.3%

      \[\leadsto \color{blue}{\frac{\ell}{w}} \]
    10. Step-by-step derivation
      1. clear-num53.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{w}{\ell}}} \]
      2. inv-pow53.4%

        \[\leadsto \color{blue}{{\left(\frac{w}{\ell}\right)}^{-1}} \]
    11. Applied egg-rr53.4%

      \[\leadsto \color{blue}{{\left(\frac{w}{\ell}\right)}^{-1}} \]
    12. Step-by-step derivation
      1. unpow-153.4%

        \[\leadsto \color{blue}{\frac{1}{\frac{w}{\ell}}} \]
    13. Simplified53.4%

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

Alternative 12: 62.8% accurate, 38.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq 0.55:\\ \;\;\;\;\ell\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{w}\\ \end{array} \end{array} \]
(FPCore (w l) :precision binary64 (if (<= w 0.55) l (/ l w)))
double code(double w, double l) {
	double tmp;
	if (w <= 0.55) {
		tmp = l;
	} else {
		tmp = l / w;
	}
	return tmp;
}
real(8) function code(w, l)
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= 0.55d0) then
        tmp = l
    else
        tmp = l / w
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= 0.55) {
		tmp = l;
	} else {
		tmp = l / w;
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= 0.55:
		tmp = l
	else:
		tmp = l / w
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= 0.55)
		tmp = l;
	else
		tmp = Float64(l / w);
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= 0.55)
		tmp = l;
	else
		tmp = l / w;
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, 0.55], l, N[(l / w), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq 0.55:\\
\;\;\;\;\ell\\

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


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

    1. Initial program 99.8%

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

      \[\leadsto \color{blue}{\ell} \]

    if 0.55000000000000004 < w

    1. Initial program 97.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
    8. Taylor expanded in w around inf 98.6%

      \[\leadsto \color{blue}{\frac{{\ell}^{\left(e^{w}\right)}}{w}} \]
    9. Taylor expanded in w around 0 53.3%

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

Alternative 13: 62.1% accurate, 61.0× speedup?

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

\\
\frac{\ell}{w + 1}
\end{array}
Derivation
  1. Initial program 99.1%

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{\color{blue}{\sqrt{w \cdot w}}}\right)} \]
    3. sqr-neg88.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-sqrt87.5%

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

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

      \[\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-unprod62.1%

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

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

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

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

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

      \[\leadsto e^{-w} \cdot {\ell}^{\left(\sqrt{{\left(e^{w}\right)}^{1} \cdot \color{blue}{\frac{1}{e^{w}}}}\right)} \]
    15. inv-pow53.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-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 inf 98.1%

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

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

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

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

    \[\leadsto \color{blue}{\frac{\ell}{e^{w}}} \]
  8. Taylor expanded in w around 0 67.9%

    \[\leadsto \frac{\ell}{\color{blue}{1 + w}} \]
  9. Step-by-step derivation
    1. +-commutative80.7%

      \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{\color{blue}{w + 1}} \]
  10. Simplified67.9%

    \[\leadsto \frac{\ell}{\color{blue}{w + 1}} \]
  11. Add Preprocessing

Alternative 14: 51.8% 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.1%

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

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

Reproduce

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