exp-w (used to crash)

Percentage Accurate: 99.4% → 99.4%
Time: 12.1s
Alternatives: 10
Speedup: N/A×

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 10 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.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);
}
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 ** 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.4%

    \[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-exp.f64N/A

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

      \[\leadsto e^{\color{blue}{\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. exp-negN/A

      \[\leadsto {\ell}^{\left(e^{w}\right)} \cdot \color{blue}{\frac{1}{e^{w}}} \]
    8. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.0% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 99.4%

      \[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-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\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. lift-neg.f64N/A

        \[\leadsto e^{\log \ell \cdot e^{w}} \cdot e^{\color{blue}{-w}} \]
      9. prod-expN/A

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

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

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

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

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

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

    if -1.2999999999999999e-16 < w

    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 + -1 \cdot w\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \left(1 - 1 \cdot w\right) \cdot {\ell}^{\left(e^{w}\right)} \]
      3. *-lft-identityN/A

        \[\leadsto \left(1 - w\right) \cdot {\ell}^{\left(e^{w}\right)} \]
      4. lower--.f6471.6

        \[\leadsto \left(1 - \color{blue}{w}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
    4. Applied rewrites71.6%

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

Alternative 3: 99.0% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1.3 \cdot 10^{-16}:\\ \;\;\;\;e^{\log \ell \cdot e^{w} - w}\\ \mathbf{else}:\\ \;\;\;\;\left(1 - w\right) \cdot {\ell}^{\left(e^{w}\right)}\\ \end{array} \end{array} \]
(FPCore (w l)
 :precision binary64
 (if (<= w -1.3e-16)
   (exp (- (* (log l) (exp w)) w))
   (* (- 1.0 w) (pow l (exp w)))))
double code(double w, double l) {
	double tmp;
	if (w <= -1.3e-16) {
		tmp = exp(((log(l) * exp(w)) - w));
	} else {
		tmp = (1.0 - w) * 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.3d-16)) then
        tmp = exp(((log(l) * exp(w)) - w))
    else
        tmp = (1.0d0 - w) * (l ** exp(w))
    end if
    code = tmp
end function
public static double code(double w, double l) {
	double tmp;
	if (w <= -1.3e-16) {
		tmp = Math.exp(((Math.log(l) * Math.exp(w)) - w));
	} else {
		tmp = (1.0 - w) * Math.pow(l, Math.exp(w));
	}
	return tmp;
}
def code(w, l):
	tmp = 0
	if w <= -1.3e-16:
		tmp = math.exp(((math.log(l) * math.exp(w)) - w))
	else:
		tmp = (1.0 - w) * math.pow(l, math.exp(w))
	return tmp
function code(w, l)
	tmp = 0.0
	if (w <= -1.3e-16)
		tmp = exp(Float64(Float64(log(l) * exp(w)) - w));
	else
		tmp = Float64(Float64(1.0 - w) * (l ^ exp(w)));
	end
	return tmp
end
function tmp_2 = code(w, l)
	tmp = 0.0;
	if (w <= -1.3e-16)
		tmp = exp(((log(l) * exp(w)) - w));
	else
		tmp = (1.0 - w) * (l ^ exp(w));
	end
	tmp_2 = tmp;
end
code[w_, l_] := If[LessEqual[w, -1.3e-16], N[Exp[N[(N[(N[Log[l], $MachinePrecision] * N[Exp[w], $MachinePrecision]), $MachinePrecision] - w), $MachinePrecision]], $MachinePrecision], N[(N[(1.0 - w), $MachinePrecision] * N[Power[l, N[Exp[w], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;w \leq -1.3 \cdot 10^{-16}:\\
\;\;\;\;e^{\log \ell \cdot e^{w} - w}\\

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


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

    1. Initial program 99.4%

      \[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-exp.f64N/A

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

        \[\leadsto e^{\color{blue}{\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. exp-negN/A

        \[\leadsto {\ell}^{\left(e^{w}\right)} \cdot \color{blue}{\frac{1}{e^{w}}} \]
      8. associate-*r/N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)} \cdot 1}}{e^{w}} \]
      3. *-rgt-identityN/A

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

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

        \[\leadsto \frac{\color{blue}{{\ell}^{\left(e^{w}\right)}}}{e^{w}} \]
      6. pow-to-expN/A

        \[\leadsto \frac{\color{blue}{e^{\log \ell \cdot e^{w}}}}{e^{w}} \]
      7. lift-exp.f64N/A

        \[\leadsto \frac{e^{\log \ell \cdot e^{w}}}{\color{blue}{e^{w}}} \]
      8. div-expN/A

        \[\leadsto \color{blue}{e^{\log \ell \cdot e^{w} - w}} \]
      9. lower-exp.f64N/A

        \[\leadsto \color{blue}{e^{\log \ell \cdot e^{w} - w}} \]
      10. lower--.f64N/A

        \[\leadsto e^{\color{blue}{\log \ell \cdot e^{w} - w}} \]
      11. lower-*.f64N/A

        \[\leadsto e^{\color{blue}{\log \ell \cdot e^{w}} - w} \]
      12. lower-log.f64N/A

        \[\leadsto e^{\color{blue}{\log \ell} \cdot e^{w} - w} \]
      13. lift-exp.f6494.9

        \[\leadsto e^{\log \ell \cdot \color{blue}{e^{w}} - w} \]
    5. Applied rewrites94.9%

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

    if -1.2999999999999999e-16 < w

    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 + -1 \cdot w\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \left(1 - 1 \cdot w\right) \cdot {\ell}^{\left(e^{w}\right)} \]
      3. *-lft-identityN/A

        \[\leadsto \left(1 - w\right) \cdot {\ell}^{\left(e^{w}\right)} \]
      4. lower--.f6471.6

        \[\leadsto \left(1 - \color{blue}{w}\right) \cdot {\ell}^{\left(e^{w}\right)} \]
    4. Applied rewrites71.6%

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

Alternative 4: 98.6% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;1 \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, 1\right), w, 1\right)\right)}\\


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

    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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
    3. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{\left(1 + w\right)}} \]
    6. Step-by-step derivation
      1. lower-+.f6477.1

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{\left(1 + \color{blue}{w}\right)} \]
    7. Applied rewrites77.1%

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

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

        \[\leadsto \left(1 + \left(\mathsf{neg}\left(w\right)\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
      2. lower-+.f64N/A

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

        \[\leadsto \left(1 + \left(-w\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
    10. Applied rewrites84.2%

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

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

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

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

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

    if 6.10000000000000004e-6 < l

    1. Initial program 99.4%

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

        \[\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 \cdot \left(1 + \frac{1}{2} \cdot w\right)\right)}} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

          \[\leadsto 1 \cdot {\ell}^{\left(\mathsf{fma}\left(\frac{1}{2} \cdot w + 1, w, 1\right)\right)} \]
        5. lower-fma.f6484.9

          \[\leadsto 1 \cdot {\ell}^{\left(\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, 1\right), w, 1\right)\right)} \]
      4. Applied rewrites84.9%

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

    Alternative 5: 94.7% accurate, 1.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1:\\ \;\;\;\;{\ell}^{\left(1 + w\right)} \cdot \left(1 + \left(-w\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{1}\\ \end{array} \end{array} \]
    (FPCore (w l)
     :precision binary64
     (if (<= l 1.0)
       (* (pow l (+ 1.0 w)) (+ 1.0 (- w)))
       (* (fma (fma 0.5 w -1.0) w 1.0) (pow l 1.0))))
    double code(double w, double l) {
    	double tmp;
    	if (l <= 1.0) {
    		tmp = pow(l, (1.0 + w)) * (1.0 + -w);
    	} else {
    		tmp = fma(fma(0.5, w, -1.0), w, 1.0) * pow(l, 1.0);
    	}
    	return tmp;
    }
    
    function code(w, l)
    	tmp = 0.0
    	if (l <= 1.0)
    		tmp = Float64((l ^ Float64(1.0 + w)) * Float64(1.0 + Float64(-w)));
    	else
    		tmp = Float64(fma(fma(0.5, w, -1.0), w, 1.0) * (l ^ 1.0));
    	end
    	return tmp
    end
    
    code[w_, l_] := If[LessEqual[l, 1.0], N[(N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision] * N[(1.0 + (-w)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * w + -1.0), $MachinePrecision] * w + 1.0), $MachinePrecision] * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;\ell \leq 1:\\
    \;\;\;\;{\ell}^{\left(1 + w\right)} \cdot \left(1 + \left(-w\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{1}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if l < 1

      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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{\left(1 + w\right)}} \]
      6. Step-by-step derivation
        1. lower-+.f6477.1

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{\left(1 + \color{blue}{w}\right)} \]
      7. Applied rewrites77.1%

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

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

          \[\leadsto \left(1 + \left(\mathsf{neg}\left(w\right)\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
        2. lower-+.f64N/A

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

          \[\leadsto \left(1 + \left(-w\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
      10. Applied rewrites84.2%

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

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

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

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

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

      if 1 < l

      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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
      3. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{1}} \]
      6. Step-by-step derivation
        1. Applied rewrites73.2%

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

      Alternative 6: 91.4% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1.02 \cdot 10^{+154}:\\ \;\;\;\;\left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1}\\ \mathbf{else}:\\ \;\;\;\;{\ell}^{\left(1 + w\right)} \cdot \left(1 + \left(-w\right)\right)\\ \end{array} \end{array} \]
      (FPCore (w l)
       :precision binary64
       (if (<= w -1.02e+154)
         (* (* (* w w) 0.5) (pow l 1.0))
         (* (pow l (+ 1.0 w)) (+ 1.0 (- w)))))
      double code(double w, double l) {
      	double tmp;
      	if (w <= -1.02e+154) {
      		tmp = ((w * w) * 0.5) * pow(l, 1.0);
      	} else {
      		tmp = pow(l, (1.0 + w)) * (1.0 + -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.02d+154)) then
              tmp = ((w * w) * 0.5d0) * (l ** 1.0d0)
          else
              tmp = (l ** (1.0d0 + w)) * (1.0d0 + -w)
          end if
          code = tmp
      end function
      
      public static double code(double w, double l) {
      	double tmp;
      	if (w <= -1.02e+154) {
      		tmp = ((w * w) * 0.5) * Math.pow(l, 1.0);
      	} else {
      		tmp = Math.pow(l, (1.0 + w)) * (1.0 + -w);
      	}
      	return tmp;
      }
      
      def code(w, l):
      	tmp = 0
      	if w <= -1.02e+154:
      		tmp = ((w * w) * 0.5) * math.pow(l, 1.0)
      	else:
      		tmp = math.pow(l, (1.0 + w)) * (1.0 + -w)
      	return tmp
      
      function code(w, l)
      	tmp = 0.0
      	if (w <= -1.02e+154)
      		tmp = Float64(Float64(Float64(w * w) * 0.5) * (l ^ 1.0));
      	else
      		tmp = Float64((l ^ Float64(1.0 + w)) * Float64(1.0 + Float64(-w)));
      	end
      	return tmp
      end
      
      function tmp_2 = code(w, l)
      	tmp = 0.0;
      	if (w <= -1.02e+154)
      		tmp = ((w * w) * 0.5) * (l ^ 1.0);
      	else
      		tmp = (l ^ (1.0 + w)) * (1.0 + -w);
      	end
      	tmp_2 = tmp;
      end
      
      code[w_, l_] := If[LessEqual[w, -1.02e+154], N[(N[(N[(w * w), $MachinePrecision] * 0.5), $MachinePrecision] * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision], N[(N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision] * N[(1.0 + (-w)), $MachinePrecision]), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;w \leq -1.02 \cdot 10^{+154}:\\
      \;\;\;\;\left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1}\\
      
      \mathbf{else}:\\
      \;\;\;\;{\ell}^{\left(1 + w\right)} \cdot \left(1 + \left(-w\right)\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if w < -1.02000000000000007e154

        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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
        3. Step-by-step derivation
          1. +-commutativeN/A

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{1}} \]
        6. Step-by-step derivation
          1. Applied rewrites73.2%

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

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

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

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

              \[\leadsto \left(\left(w \cdot w\right) \cdot \frac{1}{2}\right) \cdot {\ell}^{1} \]
            4. lower-*.f6421.3

              \[\leadsto \left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1} \]
          4. Applied rewrites21.3%

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

          if -1.02000000000000007e154 < w

          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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{\left(1 + w\right)}} \]
          6. Step-by-step derivation
            1. lower-+.f6477.1

              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.5, w, -1\right), w, 1\right) \cdot {\ell}^{\left(1 + \color{blue}{w}\right)} \]
          7. Applied rewrites77.1%

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

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

              \[\leadsto \left(1 + \left(\mathsf{neg}\left(w\right)\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
            2. lower-+.f64N/A

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

              \[\leadsto \left(1 + \left(-w\right)\right) \cdot {\ell}^{\left(1 + w\right)} \]
          10. Applied rewrites84.2%

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

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

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

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

            \[\leadsto \color{blue}{{\ell}^{\left(1 + w\right)} \cdot \left(1 + \left(-w\right)\right)} \]
        7. Recombined 2 regimes into one program.
        8. Add Preprocessing

        Alternative 7: 91.2% accurate, 1.4× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;w \leq -1.02 \cdot 10^{+154}:\\ \;\;\;\;\left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot {\ell}^{\left(1 + w\right)}\\ \end{array} \end{array} \]
        (FPCore (w l)
         :precision binary64
         (if (<= w -1.02e+154)
           (* (* (* w w) 0.5) (pow l 1.0))
           (* 1.0 (pow l (+ 1.0 w)))))
        double code(double w, double l) {
        	double tmp;
        	if (w <= -1.02e+154) {
        		tmp = ((w * w) * 0.5) * pow(l, 1.0);
        	} else {
        		tmp = 1.0 * pow(l, (1.0 + 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.02d+154)) then
                tmp = ((w * w) * 0.5d0) * (l ** 1.0d0)
            else
                tmp = 1.0d0 * (l ** (1.0d0 + w))
            end if
            code = tmp
        end function
        
        public static double code(double w, double l) {
        	double tmp;
        	if (w <= -1.02e+154) {
        		tmp = ((w * w) * 0.5) * Math.pow(l, 1.0);
        	} else {
        		tmp = 1.0 * Math.pow(l, (1.0 + w));
        	}
        	return tmp;
        }
        
        def code(w, l):
        	tmp = 0
        	if w <= -1.02e+154:
        		tmp = ((w * w) * 0.5) * math.pow(l, 1.0)
        	else:
        		tmp = 1.0 * math.pow(l, (1.0 + w))
        	return tmp
        
        function code(w, l)
        	tmp = 0.0
        	if (w <= -1.02e+154)
        		tmp = Float64(Float64(Float64(w * w) * 0.5) * (l ^ 1.0));
        	else
        		tmp = Float64(1.0 * (l ^ Float64(1.0 + w)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(w, l)
        	tmp = 0.0;
        	if (w <= -1.02e+154)
        		tmp = ((w * w) * 0.5) * (l ^ 1.0);
        	else
        		tmp = 1.0 * (l ^ (1.0 + w));
        	end
        	tmp_2 = tmp;
        end
        
        code[w_, l_] := If[LessEqual[w, -1.02e+154], N[(N[(N[(w * w), $MachinePrecision] * 0.5), $MachinePrecision] * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision], N[(1.0 * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;w \leq -1.02 \cdot 10^{+154}:\\
        \;\;\;\;\left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1}\\
        
        \mathbf{else}:\\
        \;\;\;\;1 \cdot {\ell}^{\left(1 + w\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if w < -1.02000000000000007e154

          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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
          3. Step-by-step derivation
            1. +-commutativeN/A

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{1}} \]
          6. Step-by-step derivation
            1. Applied rewrites73.2%

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

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

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

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

                \[\leadsto \left(\left(w \cdot w\right) \cdot \frac{1}{2}\right) \cdot {\ell}^{1} \]
              4. lower-*.f6421.3

                \[\leadsto \left(\left(w \cdot w\right) \cdot 0.5\right) \cdot {\ell}^{1} \]
            4. Applied rewrites21.3%

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

            if -1.02000000000000007e154 < w

            1. Initial program 99.4%

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

                \[\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. lower-+.f6484.4

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

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

            Alternative 8: 91.2% accurate, 1.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq 1:\\ \;\;\;\;1 \cdot {\ell}^{\left(1 + w\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-1, w, 1\right) \cdot {\ell}^{1}\\ \end{array} \end{array} \]
            (FPCore (w l)
             :precision binary64
             (if (<= l 1.0) (* 1.0 (pow l (+ 1.0 w))) (* (fma -1.0 w 1.0) (pow l 1.0))))
            double code(double w, double l) {
            	double tmp;
            	if (l <= 1.0) {
            		tmp = 1.0 * pow(l, (1.0 + w));
            	} else {
            		tmp = fma(-1.0, w, 1.0) * pow(l, 1.0);
            	}
            	return tmp;
            }
            
            function code(w, l)
            	tmp = 0.0
            	if (l <= 1.0)
            		tmp = Float64(1.0 * (l ^ Float64(1.0 + w)));
            	else
            		tmp = Float64(fma(-1.0, w, 1.0) * (l ^ 1.0));
            	end
            	return tmp
            end
            
            code[w_, l_] := If[LessEqual[l, 1.0], N[(1.0 * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[(-1.0 * w + 1.0), $MachinePrecision] * N[Power[l, 1.0], $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;\ell \leq 1:\\
            \;\;\;\;1 \cdot {\ell}^{\left(1 + w\right)}\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(-1, w, 1\right) \cdot {\ell}^{1}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if l < 1

              1. Initial program 99.4%

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

                  \[\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. lower-+.f6484.4

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

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

                if 1 < l

                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(\frac{1}{2} \cdot w - 1\right)\right)} \cdot {\ell}^{\left(e^{w}\right)} \]
                3. Step-by-step derivation
                  1. +-commutativeN/A

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, 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(\frac{1}{2}, w, -1\right), w, 1\right) \cdot {\ell}^{\color{blue}{1}} \]
                6. Step-by-step derivation
                  1. Applied rewrites73.2%

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

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

                      \[\leadsto \mathsf{fma}\left(-1, w, 1\right) \cdot {\ell}^{1} \]
                  4. Recombined 2 regimes into one program.
                  5. Add Preprocessing

                  Alternative 9: 84.4% accurate, 1.8× speedup?

                  \[\begin{array}{l} \\ 1 \cdot {\ell}^{\left(1 + w\right)} \end{array} \]
                  (FPCore (w l) :precision binary64 (* 1.0 (pow l (+ 1.0 w))))
                  double code(double w, double l) {
                  	return 1.0 * pow(l, (1.0 + 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 * (l ** (1.0d0 + w))
                  end function
                  
                  public static double code(double w, double l) {
                  	return 1.0 * Math.pow(l, (1.0 + w));
                  }
                  
                  def code(w, l):
                  	return 1.0 * math.pow(l, (1.0 + w))
                  
                  function code(w, l)
                  	return Float64(1.0 * (l ^ Float64(1.0 + w)))
                  end
                  
                  function tmp = code(w, l)
                  	tmp = 1.0 * (l ^ (1.0 + w));
                  end
                  
                  code[w_, l_] := N[(1.0 * N[Power[l, N[(1.0 + w), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  1 \cdot {\ell}^{\left(1 + w\right)}
                  \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}{1} \cdot {\ell}^{\left(e^{w}\right)} \]
                  3. Step-by-step derivation
                    1. Applied rewrites71.0%

                      \[\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. lower-+.f6484.4

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

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

                    Alternative 10: 56.5% accurate, 41.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 rewrites56.5%

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

                      Reproduce

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