ENA, Section 1.4, Exercise 4b, n=5

Percentage Accurate: 87.6% → 98.9%
Time: 5.4s
Alternatives: 10
Speedup: 5.4×

Specification

?
\[\left(-1000000000 \leq x \land x \leq 1000000000\right) \land \left(-1 \leq \varepsilon \land \varepsilon \leq 1\right)\]
\[\begin{array}{l} \\ {\left(x + \varepsilon\right)}^{5} - {x}^{5} \end{array} \]
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
	return pow((x + eps), 5.0) - pow(x, 5.0);
}
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(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
	return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps):
	return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps)
	return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
end
function tmp = code(x, eps)
	tmp = ((x + eps) ^ 5.0) - (x ^ 5.0);
end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 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: 87.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(x + \varepsilon\right)}^{5} - {x}^{5} \end{array} \]
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
	return pow((x + eps), 5.0) - pow(x, 5.0);
}
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(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
end function
public static double code(double x, double eps) {
	return Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
}
def code(x, eps):
	return math.pow((x + eps), 5.0) - math.pow(x, 5.0)
function code(x, eps)
	return Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
end
function tmp = code(x, eps)
	tmp = ((x + eps) ^ 5.0) - (x ^ 5.0);
end
code[x_, eps_] := N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}

Alternative 1: 98.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-294}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (<= t_0 -1e-294)
     t_0
     (if (<= t_0 0.0) (* (* (pow x 4.0) 5.0) eps) t_0))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if (t_0 <= -1e-294) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = (pow(x, 4.0) * 5.0) * eps;
	} else {
		tmp = t_0;
	}
	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(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
    if (t_0 <= (-1d-294)) then
        tmp = t_0
    else if (t_0 <= 0.0d0) then
        tmp = ((x ** 4.0d0) * 5.0d0) * eps
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
	double tmp;
	if (t_0 <= -1e-294) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = (Math.pow(x, 4.0) * 5.0) * eps;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, eps):
	t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0)
	tmp = 0
	if t_0 <= -1e-294:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = (math.pow(x, 4.0) * 5.0) * eps
	else:
		tmp = t_0
	return tmp
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if (t_0 <= -1e-294)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, eps)
	t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0);
	tmp = 0.0;
	if (t_0 <= -1e-294)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = ((x ^ 4.0) * 5.0) * eps;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -1e-294], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-294}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < -1.00000000000000002e-294 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 97.5%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]

    if -1.00000000000000002e-294 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64))) < 0.0

    1. Initial program 88.8%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
    2. Taylor expanded in eps around 0

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
      2. lower-fma.f64N/A

        \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
      3. lower-pow.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
      4. lower-pow.f6499.9

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
    4. Applied rewrites99.9%

      \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
    5. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
    6. Recombined 2 regimes into one program.
    7. Add Preprocessing

    Alternative 2: 97.7% accurate, 1.3× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \end{array} \end{array} \]
    (FPCore (x eps)
     :precision binary64
     (if (<= x -3.1e-40)
       (*
        (fma
         (/ (fma (* eps eps) -4.0 (* (* eps eps) -6.0)) x)
         -1.0
         (fma 4.0 eps eps))
        (pow x 4.0))
       (if (<= x 7.2e-46)
         (fma x (* (* 5.0 (* eps eps)) (* eps eps)) (pow eps 5.0))
         (* (* (pow x 4.0) 5.0) eps))))
    double code(double x, double eps) {
    	double tmp;
    	if (x <= -3.1e-40) {
    		tmp = fma((fma((eps * eps), -4.0, ((eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * pow(x, 4.0);
    	} else if (x <= 7.2e-46) {
    		tmp = fma(x, ((5.0 * (eps * eps)) * (eps * eps)), pow(eps, 5.0));
    	} else {
    		tmp = (pow(x, 4.0) * 5.0) * eps;
    	}
    	return tmp;
    }
    
    function code(x, eps)
    	tmp = 0.0
    	if (x <= -3.1e-40)
    		tmp = Float64(fma(Float64(fma(Float64(eps * eps), -4.0, Float64(Float64(eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * (x ^ 4.0));
    	elseif (x <= 7.2e-46)
    		tmp = fma(x, Float64(Float64(5.0 * Float64(eps * eps)) * Float64(eps * eps)), (eps ^ 5.0));
    	else
    		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
    	end
    	return tmp
    end
    
    code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * -4.0 + N[(N[(eps * eps), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * -1.0 + N[(4.0 * eps + eps), $MachinePrecision]), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(x * N[(N[(5.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}\\
    
    \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
    \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if x < -3.10000000000000011e-40

      1. Initial program 46.4%

        \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
      2. Taylor expanded in x around -inf

        \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
      3. Step-by-step derivation
        1. lower-*.f64N/A

          \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
        2. lower-pow.f64N/A

          \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
        3. lower-+.f64N/A

          \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
        4. lower-fma.f64N/A

          \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
      4. Applied rewrites90.0%

        \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
      5. Step-by-step derivation
        1. Applied rewrites90.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]

        if -3.10000000000000011e-40 < x < 7.2e-46

        1. Initial program 100.0%

          \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
        2. Taylor expanded in x around 0

          \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
        3. Step-by-step derivation
          1. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
          2. lower-fma.f64N/A

            \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
          3. lower-pow.f64N/A

            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
          4. lower-pow.f64N/A

            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
          5. lower-pow.f64100.0

            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
        4. Applied rewrites100.0%

          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
        5. Step-by-step derivation
          1. Applied rewrites100.0%

            \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]

          if 7.2e-46 < x

          1. Initial program 28.7%

            \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
          2. Taylor expanded in eps around 0

            \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
          3. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
            2. lower-fma.f64N/A

              \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
            3. lower-pow.f64N/A

              \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
            4. lower-pow.f6499.7

              \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
          4. Applied rewrites99.7%

            \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
          5. Step-by-step derivation
            1. Applied rewrites99.7%

              \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
          6. Recombined 3 regimes into one program.
          7. Add Preprocessing

          Alternative 3: 97.7% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(5, \varepsilon, \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot 10}{x}\right) \cdot {x}^{4}\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \end{array} \end{array} \]
          (FPCore (x eps)
           :precision binary64
           (if (<= x -3.1e-40)
             (* (fma 5.0 eps (/ (* (* eps eps) 10.0) x)) (pow x 4.0))
             (if (<= x 7.2e-46)
               (fma x (* (* 5.0 (* eps eps)) (* eps eps)) (pow eps 5.0))
               (* (* (pow x 4.0) 5.0) eps))))
          double code(double x, double eps) {
          	double tmp;
          	if (x <= -3.1e-40) {
          		tmp = fma(5.0, eps, (((eps * eps) * 10.0) / x)) * pow(x, 4.0);
          	} else if (x <= 7.2e-46) {
          		tmp = fma(x, ((5.0 * (eps * eps)) * (eps * eps)), pow(eps, 5.0));
          	} else {
          		tmp = (pow(x, 4.0) * 5.0) * eps;
          	}
          	return tmp;
          }
          
          function code(x, eps)
          	tmp = 0.0
          	if (x <= -3.1e-40)
          		tmp = Float64(fma(5.0, eps, Float64(Float64(Float64(eps * eps) * 10.0) / x)) * (x ^ 4.0));
          	elseif (x <= 7.2e-46)
          		tmp = fma(x, Float64(Float64(5.0 * Float64(eps * eps)) * Float64(eps * eps)), (eps ^ 5.0));
          	else
          		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
          	end
          	return tmp
          end
          
          code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(5.0 * eps + N[(N[(N[(eps * eps), $MachinePrecision] * 10.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(x * N[(N[(5.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
          \;\;\;\;\mathsf{fma}\left(5, \varepsilon, \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot 10}{x}\right) \cdot {x}^{4}\\
          
          \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
          \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if x < -3.10000000000000011e-40

            1. Initial program 46.4%

              \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
            2. Taylor expanded in x around -inf

              \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
            3. Step-by-step derivation
              1. lower-*.f64N/A

                \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
              2. lower-pow.f64N/A

                \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
              3. lower-+.f64N/A

                \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
              4. lower-fma.f64N/A

                \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
            4. Applied rewrites90.0%

              \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
            5. Step-by-step derivation
              1. Applied rewrites90.0%

                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]
              2. Step-by-step derivation
                1. Applied rewrites89.9%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(5, \varepsilon, \frac{\left(\varepsilon \cdot \varepsilon\right) \cdot 10}{x}\right) \cdot {x}^{4}} \]

                if -3.10000000000000011e-40 < x < 7.2e-46

                1. Initial program 100.0%

                  \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                2. Taylor expanded in x around 0

                  \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                3. Step-by-step derivation
                  1. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                  2. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                  3. lower-pow.f64N/A

                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                  4. lower-pow.f64N/A

                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                  5. lower-pow.f64100.0

                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                4. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                5. Step-by-step derivation
                  1. Applied rewrites100.0%

                    \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]

                  if 7.2e-46 < x

                  1. Initial program 28.7%

                    \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                  2. Taylor expanded in eps around 0

                    \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                  3. Step-by-step derivation
                    1. lower-*.f64N/A

                      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                    3. lower-pow.f64N/A

                      \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                    4. lower-pow.f6499.7

                      \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                  4. Applied rewrites99.7%

                    \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                  5. Step-by-step derivation
                    1. Applied rewrites99.7%

                      \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
                  6. Recombined 3 regimes into one program.
                  7. Add Preprocessing

                  Alternative 4: 97.6% accurate, 1.5× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \end{array} \end{array} \]
                  (FPCore (x eps)
                   :precision binary64
                   (if (<= x -3.1e-40)
                     (*
                      (fma
                       (/ (fma (* eps eps) -4.0 (* (* eps eps) -6.0)) x)
                       -1.0
                       (fma 4.0 eps eps))
                      (* (* x x) (* x x)))
                     (if (<= x 7.2e-46)
                       (fma x (* (* 5.0 (* eps eps)) (* eps eps)) (pow eps 5.0))
                       (* (* (pow x 4.0) 5.0) eps))))
                  double code(double x, double eps) {
                  	double tmp;
                  	if (x <= -3.1e-40) {
                  		tmp = fma((fma((eps * eps), -4.0, ((eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * ((x * x) * (x * x));
                  	} else if (x <= 7.2e-46) {
                  		tmp = fma(x, ((5.0 * (eps * eps)) * (eps * eps)), pow(eps, 5.0));
                  	} else {
                  		tmp = (pow(x, 4.0) * 5.0) * eps;
                  	}
                  	return tmp;
                  }
                  
                  function code(x, eps)
                  	tmp = 0.0
                  	if (x <= -3.1e-40)
                  		tmp = Float64(fma(Float64(fma(Float64(eps * eps), -4.0, Float64(Float64(eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * Float64(Float64(x * x) * Float64(x * x)));
                  	elseif (x <= 7.2e-46)
                  		tmp = fma(x, Float64(Float64(5.0 * Float64(eps * eps)) * Float64(eps * eps)), (eps ^ 5.0));
                  	else
                  		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
                  	end
                  	return tmp
                  end
                  
                  code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * -4.0 + N[(N[(eps * eps), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * -1.0 + N[(4.0 * eps + eps), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(x * N[(N[(5.0 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
                  \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
                  
                  \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
                  \;\;\;\;\mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right), {\varepsilon}^{5}\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if x < -3.10000000000000011e-40

                    1. Initial program 46.4%

                      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                    2. Taylor expanded in x around -inf

                      \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                    3. Step-by-step derivation
                      1. lower-*.f64N/A

                        \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                      2. lower-pow.f64N/A

                        \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
                      3. lower-+.f64N/A

                        \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                      4. lower-fma.f64N/A

                        \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
                    4. Applied rewrites90.0%

                      \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
                    5. Step-by-step derivation
                      1. Applied rewrites90.0%

                        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]
                      2. Step-by-step derivation
                        1. Applied rewrites89.5%

                          \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]

                        if -3.10000000000000011e-40 < x < 7.2e-46

                        1. Initial program 100.0%

                          \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                        2. Taylor expanded in x around 0

                          \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                        3. Step-by-step derivation
                          1. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                          2. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                          3. lower-pow.f64N/A

                            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                          4. lower-pow.f64N/A

                            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                          5. lower-pow.f64100.0

                            \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                        4. Applied rewrites100.0%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                        5. Step-by-step derivation
                          1. Applied rewrites100.0%

                            \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]

                          if 7.2e-46 < x

                          1. Initial program 28.7%

                            \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                          2. Taylor expanded in eps around 0

                            \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                          3. Step-by-step derivation
                            1. lower-*.f64N/A

                              \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                            2. lower-fma.f64N/A

                              \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                            3. lower-pow.f64N/A

                              \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                            4. lower-pow.f6499.7

                              \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                          4. Applied rewrites99.7%

                            \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                          5. Step-by-step derivation
                            1. Applied rewrites99.7%

                              \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
                          6. Recombined 3 regimes into one program.
                          7. Add Preprocessing

                          Alternative 5: 97.6% accurate, 1.7× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\ \;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \end{array} \end{array} \]
                          (FPCore (x eps)
                           :precision binary64
                           (if (<= x -3.1e-40)
                             (*
                              (fma
                               (/ (fma (* eps eps) -4.0 (* (* eps eps) -6.0)) x)
                               -1.0
                               (fma 4.0 eps eps))
                              (* (* x x) (* x x)))
                             (if (<= x 7.2e-46)
                               (* (fma 5.0 x eps) (pow eps 4.0))
                               (* (* (pow x 4.0) 5.0) eps))))
                          double code(double x, double eps) {
                          	double tmp;
                          	if (x <= -3.1e-40) {
                          		tmp = fma((fma((eps * eps), -4.0, ((eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * ((x * x) * (x * x));
                          	} else if (x <= 7.2e-46) {
                          		tmp = fma(5.0, x, eps) * pow(eps, 4.0);
                          	} else {
                          		tmp = (pow(x, 4.0) * 5.0) * eps;
                          	}
                          	return tmp;
                          }
                          
                          function code(x, eps)
                          	tmp = 0.0
                          	if (x <= -3.1e-40)
                          		tmp = Float64(fma(Float64(fma(Float64(eps * eps), -4.0, Float64(Float64(eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * Float64(Float64(x * x) * Float64(x * x)));
                          	elseif (x <= 7.2e-46)
                          		tmp = Float64(fma(5.0, x, eps) * (eps ^ 4.0));
                          	else
                          		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
                          	end
                          	return tmp
                          end
                          
                          code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * -4.0 + N[(N[(eps * eps), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * -1.0 + N[(4.0 * eps + eps), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(N[(5.0 * x + eps), $MachinePrecision] * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
                          \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
                          
                          \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
                          \;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if x < -3.10000000000000011e-40

                            1. Initial program 46.4%

                              \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                            2. Taylor expanded in x around -inf

                              \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                            3. Step-by-step derivation
                              1. lower-*.f64N/A

                                \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                              2. lower-pow.f64N/A

                                \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
                              3. lower-+.f64N/A

                                \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                              4. lower-fma.f64N/A

                                \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
                            4. Applied rewrites90.0%

                              \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
                            5. Step-by-step derivation
                              1. Applied rewrites90.0%

                                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]
                              2. Step-by-step derivation
                                1. Applied rewrites89.5%

                                  \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]

                                if -3.10000000000000011e-40 < x < 7.2e-46

                                1. Initial program 100.0%

                                  \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                2. Taylor expanded in x around 0

                                  \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                                3. Step-by-step derivation
                                  1. lower-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                                  2. lower-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                                  3. lower-pow.f64N/A

                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                                  4. lower-pow.f64N/A

                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                                  5. lower-pow.f64100.0

                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                                4. Applied rewrites100.0%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                                5. Step-by-step derivation
                                  1. Applied rewrites100.0%

                                    \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites99.9%

                                      \[\leadsto \color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}} \]

                                    if 7.2e-46 < x

                                    1. Initial program 28.7%

                                      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                    2. Taylor expanded in eps around 0

                                      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                    3. Step-by-step derivation
                                      1. lower-*.f64N/A

                                        \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                      2. lower-fma.f64N/A

                                        \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                      3. lower-pow.f64N/A

                                        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                      4. lower-pow.f6499.7

                                        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                    4. Applied rewrites99.7%

                                      \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                    5. Step-by-step derivation
                                      1. Applied rewrites99.7%

                                        \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
                                    6. Recombined 3 regimes into one program.
                                    7. Add Preprocessing

                                    Alternative 6: 97.5% accurate, 1.7× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\ \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\ \mathbf{else}:\\ \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\ \end{array} \end{array} \]
                                    (FPCore (x eps)
                                     :precision binary64
                                     (if (<= x -3.1e-40)
                                       (*
                                        (fma
                                         (/ (fma (* eps eps) -4.0 (* (* eps eps) -6.0)) x)
                                         -1.0
                                         (fma 4.0 eps eps))
                                        (* (* x x) (* x x)))
                                       (if (<= x 7.2e-46)
                                         (* (* (fma 5.0 x eps) (* eps eps)) (* eps eps))
                                         (* (* (pow x 4.0) 5.0) eps))))
                                    double code(double x, double eps) {
                                    	double tmp;
                                    	if (x <= -3.1e-40) {
                                    		tmp = fma((fma((eps * eps), -4.0, ((eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * ((x * x) * (x * x));
                                    	} else if (x <= 7.2e-46) {
                                    		tmp = (fma(5.0, x, eps) * (eps * eps)) * (eps * eps);
                                    	} else {
                                    		tmp = (pow(x, 4.0) * 5.0) * eps;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    function code(x, eps)
                                    	tmp = 0.0
                                    	if (x <= -3.1e-40)
                                    		tmp = Float64(fma(Float64(fma(Float64(eps * eps), -4.0, Float64(Float64(eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * Float64(Float64(x * x) * Float64(x * x)));
                                    	elseif (x <= 7.2e-46)
                                    		tmp = Float64(Float64(fma(5.0, x, eps) * Float64(eps * eps)) * Float64(eps * eps));
                                    	else
                                    		tmp = Float64(Float64((x ^ 4.0) * 5.0) * eps);
                                    	end
                                    	return tmp
                                    end
                                    
                                    code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * -4.0 + N[(N[(eps * eps), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * -1.0 + N[(4.0 * eps + eps), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.2e-46], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] * eps), $MachinePrecision]]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
                                    \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
                                    
                                    \mathbf{elif}\;x \leq 7.2 \cdot 10^{-46}:\\
                                    \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\
                                    
                                    \mathbf{else}:\\
                                    \;\;\;\;\left({x}^{4} \cdot 5\right) \cdot \varepsilon\\
                                    
                                    
                                    \end{array}
                                    \end{array}
                                    
                                    Derivation
                                    1. Split input into 3 regimes
                                    2. if x < -3.10000000000000011e-40

                                      1. Initial program 46.4%

                                        \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                      2. Taylor expanded in x around -inf

                                        \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                      3. Step-by-step derivation
                                        1. lower-*.f64N/A

                                          \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                        2. lower-pow.f64N/A

                                          \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
                                        3. lower-+.f64N/A

                                          \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                        4. lower-fma.f64N/A

                                          \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
                                      4. Applied rewrites90.0%

                                        \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
                                      5. Step-by-step derivation
                                        1. Applied rewrites90.0%

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]
                                        2. Step-by-step derivation
                                          1. Applied rewrites89.5%

                                            \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]

                                          if -3.10000000000000011e-40 < x < 7.2e-46

                                          1. Initial program 100.0%

                                            \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                          2. Taylor expanded in x around 0

                                            \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                                          3. Step-by-step derivation
                                            1. lower-fma.f64N/A

                                              \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                                            2. lower-fma.f64N/A

                                              \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                                            3. lower-pow.f64N/A

                                              \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                                            4. lower-pow.f64N/A

                                              \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                                            5. lower-pow.f64100.0

                                              \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                                          4. Applied rewrites100.0%

                                            \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                                          5. Step-by-step derivation
                                            1. Applied rewrites100.0%

                                              \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]
                                            2. Step-by-step derivation
                                              1. Applied rewrites99.9%

                                                \[\leadsto \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \]

                                              if 7.2e-46 < x

                                              1. Initial program 28.7%

                                                \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                              2. Taylor expanded in eps around 0

                                                \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                              3. Step-by-step derivation
                                                1. lower-*.f64N/A

                                                  \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                2. lower-fma.f64N/A

                                                  \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                3. lower-pow.f64N/A

                                                  \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                                4. lower-pow.f6499.7

                                                  \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                              4. Applied rewrites99.7%

                                                \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                              5. Step-by-step derivation
                                                1. Applied rewrites99.7%

                                                  \[\leadsto \color{blue}{\left({x}^{4} \cdot 5\right) \cdot \varepsilon} \]
                                              6. Recombined 3 regimes into one program.
                                              7. Add Preprocessing

                                              Alternative 7: 97.5% accurate, 2.9× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-46}:\\ \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right)\\ \end{array} \end{array} \]
                                              (FPCore (x eps)
                                               :precision binary64
                                               (if (<= x -3.1e-40)
                                                 (*
                                                  (fma
                                                   (/ (fma (* eps eps) -4.0 (* (* eps eps) -6.0)) x)
                                                   -1.0
                                                   (fma 4.0 eps eps))
                                                  (* (* x x) (* x x)))
                                                 (if (<= x 5.5e-46)
                                                   (* (* (fma 5.0 x eps) (* eps eps)) (* eps eps))
                                                   (* (* (* (* 5.0 x) eps) x) (* x x)))))
                                              double code(double x, double eps) {
                                              	double tmp;
                                              	if (x <= -3.1e-40) {
                                              		tmp = fma((fma((eps * eps), -4.0, ((eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * ((x * x) * (x * x));
                                              	} else if (x <= 5.5e-46) {
                                              		tmp = (fma(5.0, x, eps) * (eps * eps)) * (eps * eps);
                                              	} else {
                                              		tmp = (((5.0 * x) * eps) * x) * (x * x);
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(x, eps)
                                              	tmp = 0.0
                                              	if (x <= -3.1e-40)
                                              		tmp = Float64(fma(Float64(fma(Float64(eps * eps), -4.0, Float64(Float64(eps * eps) * -6.0)) / x), -1.0, fma(4.0, eps, eps)) * Float64(Float64(x * x) * Float64(x * x)));
                                              	elseif (x <= 5.5e-46)
                                              		tmp = Float64(Float64(fma(5.0, x, eps) * Float64(eps * eps)) * Float64(eps * eps));
                                              	else
                                              		tmp = Float64(Float64(Float64(Float64(5.0 * x) * eps) * x) * Float64(x * x));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[x_, eps_] := If[LessEqual[x, -3.1e-40], N[(N[(N[(N[(N[(eps * eps), $MachinePrecision] * -4.0 + N[(N[(eps * eps), $MachinePrecision] * -6.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * -1.0 + N[(4.0 * eps + eps), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.5e-46], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(5.0 * x), $MachinePrecision] * eps), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
                                              \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\\
                                              
                                              \mathbf{elif}\;x \leq 5.5 \cdot 10^{-46}:\\
                                              \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 3 regimes
                                              2. if x < -3.10000000000000011e-40

                                                1. Initial program 46.4%

                                                  \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                2. Taylor expanded in x around -inf

                                                  \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                                3. Step-by-step derivation
                                                  1. lower-*.f64N/A

                                                    \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                                  2. lower-pow.f64N/A

                                                    \[\leadsto \color{blue}{{x}^{4}} \cdot \left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right) \]
                                                  3. lower-+.f64N/A

                                                    \[\leadsto {x}^{4} \cdot \color{blue}{\left(\varepsilon + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
                                                  4. lower-fma.f64N/A

                                                    \[\leadsto {x}^{4} \cdot \left(\varepsilon + \color{blue}{\mathsf{fma}\left(-1, \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}, 4 \cdot \varepsilon\right)}\right) \]
                                                4. Applied rewrites90.0%

                                                  \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon + \mathsf{fma}\left(-1, \frac{\mathsf{fma}\left(-4, {\varepsilon}^{2}, -1 \cdot \mathsf{fma}\left(2, {\varepsilon}^{2}, 4 \cdot {\varepsilon}^{2}\right)\right)}{x}, 4 \cdot \varepsilon\right)\right)} \]
                                                5. Step-by-step derivation
                                                  1. Applied rewrites90.0%

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot {x}^{4}} \]
                                                  2. Step-by-step derivation
                                                    1. Applied rewrites89.5%

                                                      \[\leadsto \mathsf{fma}\left(\frac{\mathsf{fma}\left(\varepsilon \cdot \varepsilon, -4, \left(\varepsilon \cdot \varepsilon\right) \cdot -6\right)}{x}, -1, \mathsf{fma}\left(4, \varepsilon, \varepsilon\right)\right) \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]

                                                    if -3.10000000000000011e-40 < x < 5.49999999999999983e-46

                                                    1. Initial program 100.0%

                                                      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                    2. Taylor expanded in x around 0

                                                      \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                                                    3. Step-by-step derivation
                                                      1. lower-fma.f64N/A

                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                                                      2. lower-fma.f64N/A

                                                        \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                                                      3. lower-pow.f64N/A

                                                        \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                                                      4. lower-pow.f64N/A

                                                        \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                                                      5. lower-pow.f64100.0

                                                        \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                                                    4. Applied rewrites100.0%

                                                      \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                                                    5. Step-by-step derivation
                                                      1. Applied rewrites100.0%

                                                        \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]
                                                      2. Step-by-step derivation
                                                        1. Applied rewrites99.9%

                                                          \[\leadsto \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \]

                                                        if 5.49999999999999983e-46 < x

                                                        1. Initial program 28.7%

                                                          \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                        2. Taylor expanded in eps around 0

                                                          \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                        3. Step-by-step derivation
                                                          1. lower-*.f64N/A

                                                            \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                          2. lower-fma.f64N/A

                                                            \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                          3. lower-pow.f64N/A

                                                            \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                                          4. lower-pow.f6499.7

                                                            \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                                        4. Applied rewrites99.7%

                                                          \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                        5. Step-by-step derivation
                                                          1. Applied rewrites99.4%

                                                            \[\leadsto \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
                                                          2. Step-by-step derivation
                                                            1. Applied rewrites99.6%

                                                              \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
                                                          3. Recombined 3 regimes into one program.
                                                          4. Add Preprocessing

                                                          Alternative 8: 97.4% accurate, 5.4× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right)\\ \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.5 \cdot 10^{-46}:\\ \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                                          (FPCore (x eps)
                                                           :precision binary64
                                                           (let* ((t_0 (* (* (* (* 5.0 x) eps) x) (* x x))))
                                                             (if (<= x -3.1e-40)
                                                               t_0
                                                               (if (<= x 5.5e-46) (* (* (fma 5.0 x eps) (* eps eps)) (* eps eps)) t_0))))
                                                          double code(double x, double eps) {
                                                          	double t_0 = (((5.0 * x) * eps) * x) * (x * x);
                                                          	double tmp;
                                                          	if (x <= -3.1e-40) {
                                                          		tmp = t_0;
                                                          	} else if (x <= 5.5e-46) {
                                                          		tmp = (fma(5.0, x, eps) * (eps * eps)) * (eps * eps);
                                                          	} else {
                                                          		tmp = t_0;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          function code(x, eps)
                                                          	t_0 = Float64(Float64(Float64(Float64(5.0 * x) * eps) * x) * Float64(x * x))
                                                          	tmp = 0.0
                                                          	if (x <= -3.1e-40)
                                                          		tmp = t_0;
                                                          	elseif (x <= 5.5e-46)
                                                          		tmp = Float64(Float64(fma(5.0, x, eps) * Float64(eps * eps)) * Float64(eps * eps));
                                                          	else
                                                          		tmp = t_0;
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          code[x_, eps_] := Block[{t$95$0 = N[(N[(N[(N[(5.0 * x), $MachinePrecision] * eps), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.1e-40], t$95$0, If[LessEqual[x, 5.5e-46], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision], t$95$0]]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          t_0 := \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right)\\
                                                          \mathbf{if}\;x \leq -3.1 \cdot 10^{-40}:\\
                                                          \;\;\;\;t\_0\\
                                                          
                                                          \mathbf{elif}\;x \leq 5.5 \cdot 10^{-46}:\\
                                                          \;\;\;\;\left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;t\_0\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if x < -3.10000000000000011e-40 or 5.49999999999999983e-46 < x

                                                            1. Initial program 36.8%

                                                              \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                            2. Taylor expanded in eps around 0

                                                              \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                            3. Step-by-step derivation
                                                              1. lower-*.f64N/A

                                                                \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                              2. lower-fma.f64N/A

                                                                \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                              3. lower-pow.f64N/A

                                                                \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                                              4. lower-pow.f6493.8

                                                                \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                                            4. Applied rewrites93.8%

                                                              \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                            5. Step-by-step derivation
                                                              1. Applied rewrites93.6%

                                                                \[\leadsto \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites93.8%

                                                                  \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]

                                                                if -3.10000000000000011e-40 < x < 5.49999999999999983e-46

                                                                1. Initial program 100.0%

                                                                  \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                                2. Taylor expanded in x around 0

                                                                  \[\leadsto \color{blue}{x \cdot \left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) + {\varepsilon}^{5}} \]
                                                                3. Step-by-step derivation
                                                                  1. lower-fma.f64N/A

                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(x, 4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, {\varepsilon}^{5}\right)} \]
                                                                  2. lower-fma.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(x, \color{blue}{\mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right)}, {\varepsilon}^{5}\right) \]
                                                                  3. lower-pow.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, \color{blue}{{\varepsilon}^{4}}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right) \]
                                                                  4. lower-pow.f64N/A

                                                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, \color{blue}{{\varepsilon}^{4}}\right), {\varepsilon}^{5}\right) \]
                                                                  5. lower-pow.f64100.0

                                                                    \[\leadsto \mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), \color{blue}{{\varepsilon}^{5}}\right) \]
                                                                4. Applied rewrites100.0%

                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(x, \mathsf{fma}\left(4, {\varepsilon}^{4}, {\varepsilon}^{4}\right), {\varepsilon}^{5}\right)} \]
                                                                5. Step-by-step derivation
                                                                  1. Applied rewrites100.0%

                                                                    \[\leadsto \mathsf{fma}\left(x, \left(5 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}, {\varepsilon}^{5}\right) \]
                                                                  2. Step-by-step derivation
                                                                    1. Applied rewrites99.9%

                                                                      \[\leadsto \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \]
                                                                  3. Recombined 2 regimes into one program.
                                                                  4. Add Preprocessing

                                                                  Alternative 9: 83.0% accurate, 8.0× speedup?

                                                                  \[\begin{array}{l} \\ \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right) \end{array} \]
                                                                  (FPCore (x eps) :precision binary64 (* (* (* (* 5.0 x) eps) x) (* x x)))
                                                                  double code(double x, double eps) {
                                                                  	return (((5.0 * x) * eps) * x) * (x * x);
                                                                  }
                                                                  
                                                                  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(x, eps)
                                                                  use fmin_fmax_functions
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: eps
                                                                      code = (((5.0d0 * x) * eps) * x) * (x * x)
                                                                  end function
                                                                  
                                                                  public static double code(double x, double eps) {
                                                                  	return (((5.0 * x) * eps) * x) * (x * x);
                                                                  }
                                                                  
                                                                  def code(x, eps):
                                                                  	return (((5.0 * x) * eps) * x) * (x * x)
                                                                  
                                                                  function code(x, eps)
                                                                  	return Float64(Float64(Float64(Float64(5.0 * x) * eps) * x) * Float64(x * x))
                                                                  end
                                                                  
                                                                  function tmp = code(x, eps)
                                                                  	tmp = (((5.0 * x) * eps) * x) * (x * x);
                                                                  end
                                                                  
                                                                  code[x_, eps_] := N[(N[(N[(N[(5.0 * x), $MachinePrecision] * eps), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]
                                                                  
                                                                  \begin{array}{l}
                                                                  
                                                                  \\
                                                                  \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \left(x \cdot x\right)
                                                                  \end{array}
                                                                  
                                                                  Derivation
                                                                  1. Initial program 90.4%

                                                                    \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                                  2. Taylor expanded in eps around 0

                                                                    \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                                  3. Step-by-step derivation
                                                                    1. lower-*.f64N/A

                                                                      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                                    2. lower-fma.f64N/A

                                                                      \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                                    3. lower-pow.f64N/A

                                                                      \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                                                    4. lower-pow.f6484.4

                                                                      \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                                                  4. Applied rewrites84.4%

                                                                    \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                                  5. Step-by-step derivation
                                                                    1. Applied rewrites84.4%

                                                                      \[\leadsto \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
                                                                    2. Step-by-step derivation
                                                                      1. Applied rewrites84.4%

                                                                        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot \varepsilon\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
                                                                      2. Add Preprocessing

                                                                      Alternative 10: 83.0% accurate, 8.0× speedup?

                                                                      \[\begin{array}{l} \\ \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \end{array} \]
                                                                      (FPCore (x eps) :precision binary64 (* eps (* (* 5.0 (* x x)) (* x x))))
                                                                      double code(double x, double eps) {
                                                                      	return eps * ((5.0 * (x * x)) * (x * x));
                                                                      }
                                                                      
                                                                      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(x, eps)
                                                                      use fmin_fmax_functions
                                                                          real(8), intent (in) :: x
                                                                          real(8), intent (in) :: eps
                                                                          code = eps * ((5.0d0 * (x * x)) * (x * x))
                                                                      end function
                                                                      
                                                                      public static double code(double x, double eps) {
                                                                      	return eps * ((5.0 * (x * x)) * (x * x));
                                                                      }
                                                                      
                                                                      def code(x, eps):
                                                                      	return eps * ((5.0 * (x * x)) * (x * x))
                                                                      
                                                                      function code(x, eps)
                                                                      	return Float64(eps * Float64(Float64(5.0 * Float64(x * x)) * Float64(x * x)))
                                                                      end
                                                                      
                                                                      function tmp = code(x, eps)
                                                                      	tmp = eps * ((5.0 * (x * x)) * (x * x));
                                                                      end
                                                                      
                                                                      code[x_, eps_] := N[(eps * N[(N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 90.4%

                                                                        \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
                                                                      2. Taylor expanded in eps around 0

                                                                        \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                                      3. Step-by-step derivation
                                                                        1. lower-*.f64N/A

                                                                          \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
                                                                        2. lower-fma.f64N/A

                                                                          \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                                        3. lower-pow.f64N/A

                                                                          \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, \color{blue}{{x}^{4}}, {x}^{4}\right) \]
                                                                        4. lower-pow.f6484.4

                                                                          \[\leadsto \varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, \color{blue}{{x}^{4}}\right) \]
                                                                      4. Applied rewrites84.4%

                                                                        \[\leadsto \color{blue}{\varepsilon \cdot \mathsf{fma}\left(4, {x}^{4}, {x}^{4}\right)} \]
                                                                      5. Step-by-step derivation
                                                                        1. Applied rewrites84.4%

                                                                          \[\leadsto \varepsilon \cdot \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
                                                                        2. Add Preprocessing

                                                                        Reproduce

                                                                        ?
                                                                        herbie shell --seed 2024363 -o localize:costs -o setup:simplify -o generate:simplify
                                                                        (FPCore (x eps)
                                                                          :name "ENA, Section 1.4, Exercise 4b, n=5"
                                                                          :precision binary64
                                                                          :pre (and (and (<= -1000000000.0 x) (<= x 1000000000.0)) (and (<= -1.0 eps) (<= eps 1.0)))
                                                                          (- (pow (+ x eps) 5.0) (pow x 5.0)))