exp-w (used to crash)

Percentage Accurate: 99.4% → 99.4%
Time: 17.4s
Alternatives: 12
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 12 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.3%

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

    \[\leadsto e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  4. 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.3%

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

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

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

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

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

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

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

    \[\leadsto \frac{{\ell}^{\left(e^{w}\right)}}{e^{w}} \]
  6. Add Preprocessing

Alternative 3: 97.5% 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.3%

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

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

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

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

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

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

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

    \[\leadsto \frac{\color{blue}{\ell}}{e^{w}} \]
  6. Final simplification96.8%

    \[\leadsto \frac{\ell}{e^{w}} \]
  7. Add Preprocessing

Alternative 4: 86.4% accurate, 10.2× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\ell + w \cdot \left(w \cdot \left(-1 \cdot \left(w \cdot \left(-1 \cdot \left(-1 \cdot \ell + 0.5 \cdot \ell\right) + \left(-0.5 \cdot \ell + 0.16666666666666666 \cdot \ell\right)\right)\right) - \left(-1 \cdot \ell + 0.5 \cdot \ell\right)\right) - \ell\right)} \]
    7. Step-by-step derivation
      1. associate-+r+88.1%

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

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

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

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

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

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

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

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

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

    if 0.75 < w

    1. Initial program 96.8%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg96.8%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/96.8%

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

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv87.7%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg87.7%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/87.7%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 72.9%

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

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

Alternative 5: 85.4% accurate, 12.7× speedup?

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

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

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


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

    1. Initial program 99.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\ell + w \cdot \left(w \cdot \left(-1 \cdot \left(w \cdot \left(-1 \cdot \left(-1 \cdot \ell + 0.5 \cdot \ell\right) + \left(-0.5 \cdot \ell + 0.16666666666666666 \cdot \ell\right)\right)\right) - \left(-1 \cdot \ell + 0.5 \cdot \ell\right)\right) - \ell\right)} \]
    7. Step-by-step derivation
      1. associate-+r+88.1%

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

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

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

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

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

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

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

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

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

    if 0.680000000000000049 < w

    1. Initial program 96.8%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg96.8%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/96.8%

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

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv87.7%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg87.7%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/87.7%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 66.7%

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

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

Alternative 6: 84.3% accurate, 13.9× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.5e5 < w

    1. Initial program 100.0%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg100.0%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/100.0%

        \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{e^{w}}{{\ell}^{\left(e^{w}\right)}}}} \]
    4. Applied egg-rr100.0%

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv100.0%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg100.0%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/100.0%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 75.7%

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

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

Alternative 7: 85.4% accurate, 13.9× speedup?

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

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

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


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

    1. Initial program 99.6%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity99.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg98.5%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/98.3%

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

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Taylor expanded in w around 0 88.1%

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

    if 0.650000000000000022 < w

    1. Initial program 96.8%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity96.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg96.8%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/96.8%

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

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv87.7%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg87.7%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/87.7%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 66.7%

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

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

Alternative 8: 80.7% accurate, 19.0× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.6e5 < w

    1. Initial program 100.0%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg100.0%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/100.0%

        \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{e^{w}}{{\ell}^{\left(e^{w}\right)}}}} \]
    4. Applied egg-rr100.0%

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv100.0%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg100.0%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/100.0%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 51.8%

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

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

Alternative 9: 77.4% accurate, 21.8× speedup?

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

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

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


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

    1. Initial program 99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.05e7 < w

    1. Initial program 100.0%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto e^{-w} \cdot \left(\color{blue}{e^{-w}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      18. exp-neg100.0%

        \[\leadsto e^{-w} \cdot \left(\color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)}\right) \]
      19. associate-/r/100.0%

        \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{e^{w}}{{\ell}^{\left(e^{w}\right)}}}} \]
    4. Applied egg-rr100.0%

      \[\leadsto e^{-w} \cdot \color{blue}{\frac{1}{\frac{1}{\ell}}} \]
    5. Step-by-step derivation
      1. div-inv100.0%

        \[\leadsto \color{blue}{\frac{e^{-w}}{\frac{1}{\ell}}} \]
      2. exp-neg100.0%

        \[\leadsto \frac{\color{blue}{\frac{1}{e^{w}}}}{\frac{1}{\ell}} \]
      3. associate-/l/100.0%

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

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{\ell} \cdot e^{w}}} \]
    7. Taylor expanded in w around 0 51.8%

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

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

Alternative 10: 70.4% accurate, 33.9× speedup?

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

\\
\ell + w \cdot \left(0.5 \cdot \left(w \cdot \ell\right)\right)
\end{array}
Derivation
  1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \ell + w \cdot \left(\color{blue}{\left(-w\right)} \cdot \left(-1 \cdot \ell + 0.5 \cdot \ell\right) - \ell\right) \]
    3. distribute-rgt-out72.9%

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

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

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

    \[\leadsto \ell + w \cdot \color{blue}{\left(0.5 \cdot \left(\ell \cdot w\right)\right)} \]
  10. Final simplification72.9%

    \[\leadsto \ell + w \cdot \left(0.5 \cdot \left(w \cdot \ell\right)\right) \]
  11. Add Preprocessing

Alternative 11: 63.2% accurate, 61.0× speedup?

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

\\
\ell - w \cdot \ell
\end{array}
Derivation
  1. Initial program 99.3%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\ell - \ell \cdot w} \]
  8. Simplified69.1%

    \[\leadsto \color{blue}{\ell - \ell \cdot w} \]
  9. Final simplification69.1%

    \[\leadsto \ell - w \cdot \ell \]
  10. Add Preprocessing

Alternative 12: 56.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.3%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\ell} \]
  7. Final simplification62.5%

    \[\leadsto \ell \]
  8. Add Preprocessing

Reproduce

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