exp-w (used to crash)

Percentage Accurate: 99.4% → 99.5%
Time: 12.7s
Alternatives: 11
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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w, l)
use fmin_fmax_functions
    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}

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 11 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w, l)
use fmin_fmax_functions
    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.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1.8 \cdot 10^{-7}:\\ \;\;\;\;e^{\mathsf{fma}\left(\log \ell, e^{w}, -w\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{w + 1} \cdot {\ell}^{\left(e^{w}\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w -1.8e-7)
   (exp (fma (log l) (exp w) (- w)))
   (* (/ 1.0 (+ w 1.0)) (pow l (exp w)))))
double code(double w, double l) {
	double tmp;
	if (w <= -1.8e-7) {
		tmp = exp(fma(log(l), exp(w), -w));
	} else {
		tmp = (1.0 / (w + 1.0)) * pow(l, exp(w));
	}
	return tmp;
}
function code(w, l)
	tmp = 0.0
	if (w <= -1.8e-7)
		tmp = exp(fma(log(l), exp(w), Float64(-w)));
	else
		tmp = Float64(Float64(1.0 / Float64(w + 1.0)) * (l ^ exp(w)));
	end
	return tmp
end
code[w_, l_] := If[LessEqual[w, -1.8e-7], N[Exp[N[(N[Log[l], $MachinePrecision] * N[Exp[w], $MachinePrecision] + (-w)), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 / N[(w + 1.0), $MachinePrecision]), $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.8 \cdot 10^{-7}:\\
\;\;\;\;e^{\mathsf{fma}\left(\log \ell, e^{w}, -w\right)}\\

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


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

    1. Initial program 99.8%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{e^{-w} \cdot {\ell}^{\left(e^{w}\right)}} \]
      2. lift-neg.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. lift-exp.f64N/A

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
      4. lift-exp.f64N/A

        \[\leadsto e^{\mathsf{neg}\left(w\right)} \cdot {\ell}^{\color{blue}{\left(e^{w}\right)}} \]
      5. lift-pow.f64N/A

        \[\leadsto e^{\mathsf{neg}\left(w\right)} \cdot \color{blue}{{\ell}^{\left(e^{w}\right)}} \]
      6. *-commutativeN/A

        \[\leadsto \color{blue}{{\ell}^{\left(e^{w}\right)} \cdot e^{\mathsf{neg}\left(w\right)}} \]
      7. pow-to-expN/A

        \[\leadsto \color{blue}{e^{\log \ell \cdot e^{w}}} \cdot e^{\mathsf{neg}\left(w\right)} \]
      8. prod-expN/A

        \[\leadsto \color{blue}{e^{\log \ell \cdot e^{w} + \left(\mathsf{neg}\left(w\right)\right)}} \]
      9. lower-exp.f64N/A

        \[\leadsto \color{blue}{e^{\log \ell \cdot e^{w} + \left(\mathsf{neg}\left(w\right)\right)}} \]
      10. lower-fma.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{fma}\left(\log \ell, e^{w}, \mathsf{neg}\left(w\right)\right)}} \]
      11. lower-log.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\color{blue}{\log \ell}, e^{w}, \mathsf{neg}\left(w\right)\right)} \]
      12. lift-exp.f64N/A

        \[\leadsto e^{\mathsf{fma}\left(\log \ell, \color{blue}{e^{w}}, \mathsf{neg}\left(w\right)\right)} \]
      13. lift-neg.f6499.7

        \[\leadsto e^{\mathsf{fma}\left(\log \ell, e^{w}, \color{blue}{-w}\right)} \]
    3. Applied rewrites99.7%

      \[\leadsto \color{blue}{e^{\mathsf{fma}\left(\log \ell, e^{w}, -w\right)}} \]

    if -1.79999999999999997e-7 < w

    1. Initial program 99.3%

      \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. Step-by-step derivation
      1. lift-neg.f64N/A

        \[\leadsto e^{\color{blue}{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. lift-exp.f64N/A

        \[\leadsto \color{blue}{e^{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. exp-negN/A

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      4. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
      5. lift-exp.f6499.3

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

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

      \[\leadsto \frac{1}{\color{blue}{1 + w}} \cdot {\ell}^{\left(e^{w}\right)} \]
    5. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \frac{1}{w + \color{blue}{1}} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. lower-+.f6499.3

        \[\leadsto \frac{1}{w + \color{blue}{1}} \cdot {\ell}^{\left(e^{w}\right)} \]
    6. Applied rewrites99.3%

      \[\leadsto \frac{1}{\color{blue}{w + 1}} \cdot {\ell}^{\left(e^{w}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{1}{e^{w}} \cdot {\ell}^{\left(e^{w}\right)} \end{array} \]
(FPCore (w l) :precision binary64 (* (/ 1.0 (exp w)) (pow l (exp w))))
double code(double w, double l) {
	return (1.0 / exp(w)) * pow(l, exp(w));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w, l)
use fmin_fmax_functions
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    code = (1.0d0 / exp(w)) * (l ** exp(w))
end function
public static double code(double w, double l) {
	return (1.0 / Math.exp(w)) * Math.pow(l, Math.exp(w));
}
def code(w, l):
	return (1.0 / math.exp(w)) * math.pow(l, math.exp(w))
function code(w, l)
	return Float64(Float64(1.0 / exp(w)) * (l ^ exp(w)))
end
function tmp = code(w, l)
	tmp = (1.0 / exp(w)) * (l ^ exp(w));
end
code[w_, l_] := N[(N[(1.0 / N[Exp[w], $MachinePrecision]), $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{1}{e^{w}} \cdot {\ell}^{\left(e^{w}\right)}
\end{array}
Derivation
  1. Initial program 99.4%

    \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
  2. Step-by-step derivation
    1. lift-neg.f64N/A

      \[\leadsto e^{\color{blue}{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
    2. lift-exp.f64N/A

      \[\leadsto \color{blue}{e^{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. exp-negN/A

      \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
    5. lift-exp.f6499.4

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

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

Alternative 3: 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w, l)
use fmin_fmax_functions
    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.4%

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

Alternative 4: 98.9% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1:\\ \;\;\;\;e^{-w} \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{w + 1} \cdot {\ell}^{\left(e^{w}\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w -1.0) (* (exp (- w)) l) (* (/ 1.0 (+ w 1.0)) (pow l (exp w)))))
double code(double w, double l) {
	double tmp;
	if (w <= -1.0) {
		tmp = exp(-w) * l;
	} else {
		tmp = (1.0 / (w + 1.0)) * pow(l, exp(w));
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(w, l)
use fmin_fmax_functions
    real(8), intent (in) :: w
    real(8), intent (in) :: l
    real(8) :: tmp
    if (w <= (-1.0d0)) then
        tmp = exp(-w) * l
    else
        tmp = (1.0d0 / (w + 1.0d0)) * (l ** exp(w))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= -1.0) {
		tmp = Math.exp(-w) * l;
	} else {
		tmp = (1.0 / (w + 1.0)) * Math.pow(l, Math.exp(w));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= -1.0:
		tmp = math.exp(-w) * l
	else:
		tmp = (1.0 / (w + 1.0)) * math.pow(l, math.exp(w))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= -1.0)
		tmp = Float64(exp(Float64(-w)) * l);
	else
		tmp = Float64(Float64(1.0 / Float64(w + 1.0)) * (l ^ exp(w)));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= -1.0)
		tmp = exp(-w) * l;
	else
		tmp = (1.0 / (w + 1.0)) * (l ^ exp(w));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, -1.0], N[(N[Exp[(-w)], $MachinePrecision] * l), $MachinePrecision], N[(N[(1.0 / N[(w + 1.0), $MachinePrecision]), $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -1:\\
\;\;\;\;e^{-w} \cdot \ell\\

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


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

    1. Initial program 100.0%

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

      \[\leadsto e^{-w} \cdot \color{blue}{\ell} \]
    3. Step-by-step derivation
      1. Applied rewrites99.2%

        \[\leadsto e^{-w} \cdot \color{blue}{\ell} \]

      if -1 < w

      1. Initial program 99.2%

        \[e^{-w} \cdot {\ell}^{\left(e^{w}\right)} \]
      2. Step-by-step derivation
        1. lift-neg.f64N/A

          \[\leadsto e^{\color{blue}{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
        2. lift-exp.f64N/A

          \[\leadsto \color{blue}{e^{\mathsf{neg}\left(w\right)}} \cdot {\ell}^{\left(e^{w}\right)} \]
        3. exp-negN/A

          \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
        4. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{1}{e^{w}}} \cdot {\ell}^{\left(e^{w}\right)} \]
        5. lift-exp.f6499.2

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

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

        \[\leadsto \frac{1}{\color{blue}{1 + w}} \cdot {\ell}^{\left(e^{w}\right)} \]
      5. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \frac{1}{w + \color{blue}{1}} \cdot {\ell}^{\left(e^{w}\right)} \]
        2. lower-+.f6498.8

          \[\leadsto \frac{1}{w + \color{blue}{1}} \cdot {\ell}^{\left(e^{w}\right)} \]
      6. Applied rewrites98.8%

        \[\leadsto \frac{1}{\color{blue}{w + 1}} \cdot {\ell}^{\left(e^{w}\right)} \]
    4. Recombined 2 regimes into one program.
    5. Add Preprocessing

    Alternative 5: 92.9% accurate, 2.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 \cdot {\ell}^{w}\\ \mathbf{if}\;w \leq -6.6 \cdot 10^{+104}:\\ \;\;\;\;\mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell\\ \mathbf{elif}\;w \leq -35000000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;w \leq 1:\\ \;\;\;\;\mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    (FPCore (w l)
     :precision binary64
     (let* ((t_0 (* 1.0 (pow l w))))
       (if (<= w -6.6e+104)
         (* (fma (* (* w w) -0.16666666666666666) w 1.0) l)
         (if (<= w -35000000000000.0)
           t_0
           (if (<= w 1.0)
             (* (fma (* (- (/ 0.5 w) 0.16666666666666666) (* w w)) w 1.0) l)
             t_0)))))
    double code(double w, double l) {
    	double t_0 = 1.0 * pow(l, w);
    	double tmp;
    	if (w <= -6.6e+104) {
    		tmp = fma(((w * w) * -0.16666666666666666), w, 1.0) * l;
    	} else if (w <= -35000000000000.0) {
    		tmp = t_0;
    	} else if (w <= 1.0) {
    		tmp = fma((((0.5 / w) - 0.16666666666666666) * (w * w)), w, 1.0) * l;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    function code(w, l)
    	t_0 = Float64(1.0 * (l ^ w))
    	tmp = 0.0
    	if (w <= -6.6e+104)
    		tmp = Float64(fma(Float64(Float64(w * w) * -0.16666666666666666), w, 1.0) * l);
    	elseif (w <= -35000000000000.0)
    		tmp = t_0;
    	elseif (w <= 1.0)
    		tmp = Float64(fma(Float64(Float64(Float64(0.5 / w) - 0.16666666666666666) * Float64(w * w)), w, 1.0) * l);
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    code[w_, l_] := Block[{t$95$0 = N[(1.0 * N[Power[l, w], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[w, -6.6e+104], N[(N[(N[(N[(w * w), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * w + 1.0), $MachinePrecision] * l), $MachinePrecision], If[LessEqual[w, -35000000000000.0], t$95$0, If[LessEqual[w, 1.0], N[(N[(N[(N[(N[(0.5 / w), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision] * w + 1.0), $MachinePrecision] * l), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := 1 \cdot {\ell}^{w}\\
    \mathbf{if}\;w \leq -6.6 \cdot 10^{+104}:\\
    \;\;\;\;\mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell\\
    
    \mathbf{elif}\;w \leq -35000000000000:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;w \leq 1:\\
    \;\;\;\;\mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if w < -6.59999999999999969e104

      1. Initial program 100.0%

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

        \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        2. *-commutativeN/A

          \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        3. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        4. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        5. fp-cancel-sub-sign-invN/A

          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        7. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        8. metadata-evalN/A

          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        9. lower-fma.f64N/A

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        10. +-commutativeN/A

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
        11. lower-fma.f64100.0

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
      4. Applied rewrites100.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
      5. Taylor expanded in w around 0

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
      6. Step-by-step derivation
        1. Applied rewrites100.0%

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
        2. Taylor expanded in w around inf

          \[\leadsto \mathsf{fma}\left(\frac{-1}{6} \cdot {w}^{2}, w, 1\right) \cdot \ell \]
        3. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
          2. lower-*.f64N/A

            \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
          3. unpow2N/A

            \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
          4. lower-*.f64100.0

            \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell \]
        4. Applied rewrites100.0%

          \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell \]

        if -6.59999999999999969e104 < w < -3.5e13 or 1 < w

        1. Initial program 98.7%

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

          \[\leadsto \color{blue}{1} \cdot {\ell}^{\left(e^{w}\right)} \]
        3. Step-by-step derivation
          1. Applied rewrites64.8%

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

            \[\leadsto 1 \cdot {\ell}^{\color{blue}{\left(1 + w\right)}} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

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

              \[\leadsto 1 \cdot {\ell}^{\left(w + \color{blue}{1}\right)} \]
          4. Applied rewrites81.1%

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

            \[\leadsto 1 \cdot {\ell}^{w} \]
          6. Step-by-step derivation
            1. Applied rewrites81.0%

              \[\leadsto 1 \cdot {\ell}^{w} \]

            if -3.5e13 < w < 1

            1. Initial program 99.5%

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

              \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
            3. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              2. *-commutativeN/A

                \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              3. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              4. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              5. fp-cancel-sub-sign-invN/A

                \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              6. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              7. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              8. metadata-evalN/A

                \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              9. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              10. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              11. lower-fma.f6497.3

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
            4. Applied rewrites97.3%

              \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
            5. Taylor expanded in w around 0

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
            6. Step-by-step derivation
              1. Applied rewrites95.3%

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
              2. Taylor expanded in w around inf

                \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right), w, 1\right) \cdot \ell \]
              3. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                2. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                3. lower--.f64N/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                4. associate-*r/N/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2} \cdot 1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                5. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                6. lower-/.f64N/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                7. unpow2N/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
                8. lower-*.f6495.3

                  \[\leadsto \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
              4. Applied rewrites95.3%

                \[\leadsto \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
            7. Recombined 3 regimes into one program.
            8. Add Preprocessing

            Alternative 6: 97.6% 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;
            }
            
            module fmin_fmax_functions
                implicit none
                private
                public fmax
                public fmin
            
                interface fmax
                    module procedure fmax88
                    module procedure fmax44
                    module procedure fmax84
                    module procedure fmax48
                end interface
                interface fmin
                    module procedure fmin88
                    module procedure fmin44
                    module procedure fmin84
                    module procedure fmin48
                end interface
            contains
                real(8) function fmax88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(4) function fmax44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                end function
                real(8) function fmax84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmax48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                end function
                real(8) function fmin88(x, y) result (res)
                    real(8), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(4) function fmin44(x, y) result (res)
                    real(4), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                end function
                real(8) function fmin84(x, y) result(res)
                    real(8), intent (in) :: x
                    real(4), intent (in) :: y
                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                end function
                real(8) function fmin48(x, y) result(res)
                    real(4), intent (in) :: x
                    real(8), intent (in) :: y
                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                end function
            end module
            
            real(8) function code(w, l)
            use fmin_fmax_functions
                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.4%

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

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

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

              Alternative 7: 77.5% accurate, 8.6× speedup?

              \[\begin{array}{l} \\ \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \end{array} \]
              (FPCore (w l)
               :precision binary64
               (* (fma (* (- (/ 0.5 w) 0.16666666666666666) (* w w)) w 1.0) l))
              double code(double w, double l) {
              	return fma((((0.5 / w) - 0.16666666666666666) * (w * w)), w, 1.0) * l;
              }
              
              function code(w, l)
              	return Float64(fma(Float64(Float64(Float64(0.5 / w) - 0.16666666666666666) * Float64(w * w)), w, 1.0) * l)
              end
              
              code[w_, l_] := N[(N[(N[(N[(N[(0.5 / w), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(w * w), $MachinePrecision]), $MachinePrecision] * w + 1.0), $MachinePrecision] * l), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell
              \end{array}
              
              Derivation
              1. Initial program 99.4%

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

                \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
              3. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                2. *-commutativeN/A

                  \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                3. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                4. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                5. fp-cancel-sub-sign-invN/A

                  \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                6. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                7. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                8. metadata-evalN/A

                  \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                9. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                10. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                11. lower-fma.f6480.6

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
              4. Applied rewrites80.6%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
              5. Taylor expanded in w around 0

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
              6. Step-by-step derivation
                1. Applied rewrites77.5%

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                2. Taylor expanded in w around inf

                  \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right), w, 1\right) \cdot \ell \]
                3. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  2. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  3. lower--.f64N/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} \cdot \frac{1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  4. associate-*r/N/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2} \cdot 1}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  5. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  6. lower-/.f64N/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  7. unpow2N/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{\frac{1}{2}}{w} - \frac{1}{6}\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
                  8. lower-*.f6477.5

                    \[\leadsto \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
                4. Applied rewrites77.5%

                  \[\leadsto \mathsf{fma}\left(\left(\frac{0.5}{w} - 0.16666666666666666\right) \cdot \left(w \cdot w\right), w, 1\right) \cdot \ell \]
                5. Add Preprocessing

                Alternative 8: 77.5% accurate, 14.0× speedup?

                \[\begin{array}{l} \\ \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell \end{array} \]
                (FPCore (w l)
                 :precision binary64
                 (* (fma (* (* w w) -0.16666666666666666) w 1.0) l))
                double code(double w, double l) {
                	return fma(((w * w) * -0.16666666666666666), w, 1.0) * l;
                }
                
                function code(w, l)
                	return Float64(fma(Float64(Float64(w * w) * -0.16666666666666666), w, 1.0) * l)
                end
                
                code[w_, l_] := N[(N[(N[(N[(w * w), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] * w + 1.0), $MachinePrecision] * l), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell
                \end{array}
                
                Derivation
                1. Initial program 99.4%

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

                  \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  2. *-commutativeN/A

                    \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  3. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  4. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  5. fp-cancel-sub-sign-invN/A

                    \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  6. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  7. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  8. metadata-evalN/A

                    \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  9. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  10. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  11. lower-fma.f6480.6

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                4. Applied rewrites80.6%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                5. Taylor expanded in w around 0

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                6. Step-by-step derivation
                  1. Applied rewrites77.5%

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                  2. Taylor expanded in w around inf

                    \[\leadsto \mathsf{fma}\left(\frac{-1}{6} \cdot {w}^{2}, w, 1\right) \cdot \ell \]
                  3. Step-by-step derivation
                    1. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
                    2. lower-*.f64N/A

                      \[\leadsto \mathsf{fma}\left({w}^{2} \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
                    3. unpow2N/A

                      \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot \frac{-1}{6}, w, 1\right) \cdot \ell \]
                    4. lower-*.f6477.5

                      \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell \]
                  4. Applied rewrites77.5%

                    \[\leadsto \mathsf{fma}\left(\left(w \cdot w\right) \cdot -0.16666666666666666, w, 1\right) \cdot \ell \]
                  5. Add Preprocessing

                  Alternative 9: 74.1% accurate, 17.2× speedup?

                  \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot \ell \end{array} \]
                  (FPCore (w l) :precision binary64 (* (fma (fma 0.5 w -1.0) w 1.0) l))
                  double code(double w, double l) {
                  	return fma(fma(0.5, w, -1.0), w, 1.0) * l;
                  }
                  
                  function code(w, l)
                  	return Float64(fma(fma(0.5, w, -1.0), w, 1.0) * l)
                  end
                  
                  code[w_, l_] := N[(N[(N[(0.5 * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision] * l), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot \ell
                  \end{array}
                  
                  Derivation
                  1. Initial program 99.4%

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

                    \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                  3. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    2. *-commutativeN/A

                      \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    3. lower-fma.f64N/A

                      \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    4. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    5. fp-cancel-sub-sign-invN/A

                      \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    6. *-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    7. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    8. metadata-evalN/A

                      \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    9. lower-fma.f64N/A

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    10. +-commutativeN/A

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                    11. lower-fma.f6480.6

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                  4. Applied rewrites80.6%

                    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                  5. Taylor expanded in w around 0

                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                  6. Step-by-step derivation
                    1. Applied rewrites77.5%

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                    2. Taylor expanded in w around 0

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2}, w, -1\right), w, 1\right) \cdot \ell \]
                    3. Step-by-step derivation
                      1. Applied rewrites74.1%

                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot \ell \]
                      2. Add Preprocessing

                      Alternative 10: 64.0% accurate, 25.8× speedup?

                      \[\begin{array}{l} \\ \mathsf{fma}\left(-1, w, 1\right) \cdot \ell \end{array} \]
                      (FPCore (w l) :precision binary64 (* (fma -1.0 w 1.0) l))
                      double code(double w, double l) {
                      	return fma(-1.0, w, 1.0) * l;
                      }
                      
                      function code(w, l)
                      	return Float64(fma(-1.0, w, 1.0) * l)
                      end
                      
                      code[w_, l_] := N[(N[(-1.0 * w + 1.0), $MachinePrecision] * l), $MachinePrecision]
                      
                      \begin{array}{l}
                      
                      \\
                      \mathsf{fma}\left(-1, w, 1\right) \cdot \ell
                      \end{array}
                      
                      Derivation
                      1. Initial program 99.4%

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

                        \[\leadsto \color{blue}{\left(1 + w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                      3. Step-by-step derivation
                        1. +-commutativeN/A

                          \[\leadsto \left(w \cdot \left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) + \color{blue}{1}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        2. *-commutativeN/A

                          \[\leadsto \left(\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1\right) \cdot w + 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        3. lower-fma.f64N/A

                          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1, \color{blue}{w}, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        4. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) - 1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        5. fp-cancel-sub-sign-invN/A

                          \[\leadsto \mathsf{fma}\left(w \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        6. *-commutativeN/A

                          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + \left(\mathsf{neg}\left(1\right)\right) \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        7. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1 \cdot 1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        8. metadata-evalN/A

                          \[\leadsto \mathsf{fma}\left(\left(\frac{1}{2} + \frac{-1}{6} \cdot w\right) \cdot w + -1, w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        9. lower-fma.f64N/A

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{2} + \frac{-1}{6} \cdot w, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        10. +-commutativeN/A

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6} \cdot w + \frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                        11. lower-fma.f6480.6

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot {\ell}^{\left(e^{w}\right)} \]
                      4. Applied rewrites80.6%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                      5. Taylor expanded in w around 0

                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{6}, w, \frac{1}{2}\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                      6. Step-by-step derivation
                        1. Applied rewrites77.5%

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, w, 0.5\right), w, -1\right), w, 1\right) \cdot \color{blue}{\ell} \]
                        2. Taylor expanded in w around 0

                          \[\leadsto \mathsf{fma}\left(-1, w, 1\right) \cdot \ell \]
                        3. Step-by-step derivation
                          1. Applied rewrites64.0%

                            \[\leadsto \mathsf{fma}\left(-1, w, 1\right) \cdot \ell \]
                          2. Add Preprocessing

                          Alternative 11: 57.2% accurate, 309.0× speedup?

                          \[\begin{array}{l} \\ \ell \end{array} \]
                          (FPCore (w l) :precision binary64 l)
                          double code(double w, double l) {
                          	return l;
                          }
                          
                          module fmin_fmax_functions
                              implicit none
                              private
                              public fmax
                              public fmin
                          
                              interface fmax
                                  module procedure fmax88
                                  module procedure fmax44
                                  module procedure fmax84
                                  module procedure fmax48
                              end interface
                              interface fmin
                                  module procedure fmin88
                                  module procedure fmin44
                                  module procedure fmin84
                                  module procedure fmin48
                              end interface
                          contains
                              real(8) function fmax88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmax44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmax84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmax48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                              end function
                              real(8) function fmin88(x, y) result (res)
                                  real(8), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(4) function fmin44(x, y) result (res)
                                  real(4), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                              end function
                              real(8) function fmin84(x, y) result(res)
                                  real(8), intent (in) :: x
                                  real(4), intent (in) :: y
                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                              end function
                              real(8) function fmin48(x, y) result(res)
                                  real(4), intent (in) :: x
                                  real(8), intent (in) :: y
                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                              end function
                          end module
                          
                          real(8) function code(w, l)
                          use fmin_fmax_functions
                              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.4%

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

                            \[\leadsto \color{blue}{\ell} \]
                          3. Step-by-step derivation
                            1. Applied rewrites57.2%

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

                            Reproduce

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