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

Percentage Accurate: 88.2% → 98.8%
Time: 4.2s
Alternatives: 16
Speedup: 0.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 16 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: 88.2% 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.8% 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^{-286} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (or (<= t_0 -1e-286) (not (<= t_0 0.0)))
     t_0
     (* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	}
	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-286)) .or. (.not. (t_0 <= 0.0d0))) then
        tmp = t_0
    else
        tmp = (5.0d0 * (x ** 4.0d0)) * eps
    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-286) || !(t_0 <= 0.0)) {
		tmp = t_0;
	} else {
		tmp = (5.0 * Math.pow(x, 4.0)) * eps;
	}
	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-286) or not (t_0 <= 0.0):
		tmp = t_0
	else:
		tmp = (5.0 * math.pow(x, 4.0)) * eps
	return tmp
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0))
		tmp = t_0;
	else
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	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-286) || ~((t_0 <= 0.0)))
		tmp = t_0;
	else
		tmp = (5.0 * (x ^ 4.0)) * eps;
	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[Or[LessEqual[t$95$0, -1e-286], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], t$95$0, N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\


\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.00000000000000005e-286 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 98.3%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
    2. Add Preprocessing

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(5 \cdot {x}^{4}\right) \cdot \varepsilon} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq -1 \cdot 10^{-286} \lor \neg \left({\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq 0\right):\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 98.2% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{x \cdot x}{\varepsilon}, 10, 5 \cdot x\right)}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (or (<= t_0 -1e-286) (not (<= t_0 0.0)))
     (* (- (/ (fma (/ (* x x) eps) 10.0 (* 5.0 x)) eps) -1.0) (pow eps 5.0))
     (* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0)) {
		tmp = ((fma(((x * x) / eps), 10.0, (5.0 * x)) / eps) - -1.0) * pow(eps, 5.0);
	} else {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0))
		tmp = Float64(Float64(Float64(fma(Float64(Float64(x * x) / eps), 10.0, Float64(5.0 * x)) / eps) - -1.0) * (eps ^ 5.0));
	else
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	end
	return 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[Or[LessEqual[t$95$0, -1e-286], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(N[(N[(N[(x * x), $MachinePrecision] / eps), $MachinePrecision] * 10.0 + N[(5.0 * x), $MachinePrecision]), $MachinePrecision] / eps), $MachinePrecision] - -1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{x \cdot x}{\varepsilon}, 10, 5 \cdot x\right)}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\

\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\


\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.00000000000000005e-286 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 98.3%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around -inf

      \[\leadsto -1 \cdot \color{blue}{\left({\varepsilon}^{5} \cdot \left(-1 \cdot \frac{5 \cdot x + 10 \cdot \frac{{x}^{2}}{\varepsilon}}{\varepsilon} - 1\right)\right)} \]
    7. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left({\varepsilon}^{5} \cdot \left(-1 \cdot \frac{5 \cdot x + 10 \cdot \frac{{x}^{2}}{\varepsilon}}{\varepsilon} - 1\right)\right) \]
      2. lower-neg.f64N/A

        \[\leadsto -{\varepsilon}^{5} \cdot \left(-1 \cdot \frac{5 \cdot x + 10 \cdot \frac{{x}^{2}}{\varepsilon}}{\varepsilon} - 1\right) \]
      3. *-commutativeN/A

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

        \[\leadsto -\left(-1 \cdot \frac{5 \cdot x + 10 \cdot \frac{{x}^{2}}{\varepsilon}}{\varepsilon} - 1\right) \cdot {\varepsilon}^{5} \]
    8. Applied rewrites96.7%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(5 \cdot {x}^{4}\right) \cdot \varepsilon} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq -1 \cdot 10^{-286} \lor \neg \left({\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq 0\right):\\ \;\;\;\;\left(\frac{\mathsf{fma}\left(\frac{x \cdot x}{\varepsilon}, 10, 5 \cdot x\right)}{\varepsilon} - -1\right) \cdot {\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\ \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-286)
     (* (fma (- eps (* -5.0 x)) eps (* 10.0 (* x x))) (pow eps 3.0))
     (if (<= t_0 0.0)
       (* (* 5.0 (pow x 4.0)) eps)
       (fma (* 5.0 (* (* eps eps) (* eps eps))) x (pow eps 5.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-286) {
		tmp = fma((eps - (-5.0 * x)), eps, (10.0 * (x * x))) * pow(eps, 3.0);
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	} else {
		tmp = fma((5.0 * ((eps * eps) * (eps * eps))), x, pow(eps, 5.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-286)
		tmp = Float64(fma(Float64(eps - Float64(-5.0 * x)), eps, Float64(10.0 * Float64(x * x))) * (eps ^ 3.0));
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	else
		tmp = fma(Float64(5.0 * Float64(Float64(eps * eps) * Float64(eps * eps))), x, (eps ^ 5.0));
	end
	return 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-286], N[(N[(N[(eps - N[(-5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.7

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, \color{blue}{x}, {\varepsilon}^{5}\right) \]
      3. distribute-lft1-inN/A

        \[\leadsto \mathsf{fma}\left(\left(4 + 1\right) \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      4. metadata-evalN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right)} \]
    6. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{\left(2 + 2\right)}, x, {\varepsilon}^{5}\right) \]
      3. pow-prod-upN/A

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

        \[\leadsto \mathsf{fma}\left(5 \cdot \left({\varepsilon}^{2} \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
      8. lift-*.f6495.7

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
    7. Applied rewrites95.7%

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

Alternative 4: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\ \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-286)
     (* (fma (fma 5.0 x eps) eps (* 10.0 (* x x))) (pow eps 3.0))
     (if (<= t_0 0.0)
       (* (* 5.0 (pow x 4.0)) eps)
       (fma (* 5.0 (* (* eps eps) (* eps eps))) x (pow eps 5.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-286) {
		tmp = fma(fma(5.0, x, eps), eps, (10.0 * (x * x))) * pow(eps, 3.0);
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	} else {
		tmp = fma((5.0 * ((eps * eps) * (eps * eps))), x, pow(eps, 5.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-286)
		tmp = Float64(fma(fma(5.0, x, eps), eps, Float64(10.0 * Float64(x * x))) * (eps ^ 3.0));
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	else
		tmp = fma(Float64(5.0 * Float64(Float64(eps * eps) * Float64(eps * eps))), x, (eps ^ 5.0));
	end
	return 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-286], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Power[eps, 3.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, \color{blue}{x}, {\varepsilon}^{5}\right) \]
      3. distribute-lft1-inN/A

        \[\leadsto \mathsf{fma}\left(\left(4 + 1\right) \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      4. metadata-evalN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right)} \]
    6. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{\left(2 + 2\right)}, x, {\varepsilon}^{5}\right) \]
      3. pow-prod-upN/A

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

        \[\leadsto \mathsf{fma}\left(5 \cdot \left({\varepsilon}^{2} \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
      8. lift-*.f6495.7

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
    7. Applied rewrites95.7%

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

Alternative 5: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5}\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\ \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-286)
     (* (fma 5.0 (/ x eps) 1.0) (pow eps 5.0))
     (if (<= t_0 0.0)
       (* (* 5.0 (pow x 4.0)) eps)
       (fma (* 5.0 (* (* eps eps) (* eps eps))) x (pow eps 5.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-286) {
		tmp = fma(5.0, (x / eps), 1.0) * pow(eps, 5.0);
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	} else {
		tmp = fma((5.0 * ((eps * eps) * (eps * eps))), x, pow(eps, 5.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-286)
		tmp = Float64(fma(5.0, Float64(x / eps), 1.0) * (eps ^ 5.0));
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	else
		tmp = fma(Float64(5.0 * Float64(Float64(eps * eps) * Float64(eps * eps))), x, (eps ^ 5.0));
	end
	return 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-286], N[(N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * N[(N[(eps * eps), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * x + N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right)\\


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

    1. Initial program 99.8%

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

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

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

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

        \[\leadsto \left(\left(4 \cdot \frac{x}{\varepsilon} + \frac{x}{\varepsilon}\right) + 1\right) \cdot {\color{blue}{\varepsilon}}^{5} \]
      4. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot \frac{x}{\varepsilon} + 1\right) \cdot {\varepsilon}^{5} \]
      5. metadata-evalN/A

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

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

        \[\leadsto \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5} \]
      8. lower-pow.f6496.5

        \[\leadsto \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{\color{blue}{5}} \]
    5. Applied rewrites96.5%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, \color{blue}{x}, {\varepsilon}^{5}\right) \]
      3. distribute-lft1-inN/A

        \[\leadsto \mathsf{fma}\left(\left(4 + 1\right) \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      4. metadata-evalN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right)} \]
    6. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      2. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(5 \cdot {\varepsilon}^{\left(2 + 2\right)}, x, {\varepsilon}^{5}\right) \]
      3. pow-prod-upN/A

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

        \[\leadsto \mathsf{fma}\left(5 \cdot \left({\varepsilon}^{2} \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot {\varepsilon}^{2}\right), x, {\varepsilon}^{5}\right) \]
      7. pow2N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
      8. lift-*.f6495.7

        \[\leadsto \mathsf{fma}\left(5 \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right), x, {\varepsilon}^{5}\right) \]
    7. Applied rewrites95.7%

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

Alternative 6: 98.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;\mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (or (<= t_0 -1e-286) (not (<= t_0 0.0)))
     (* (fma 5.0 (/ x eps) 1.0) (pow eps 5.0))
     (* (* 5.0 (pow x 4.0)) eps))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0)) {
		tmp = fma(5.0, (x / eps), 1.0) * pow(eps, 5.0);
	} else {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0))
		tmp = Float64(fma(5.0, Float64(x / eps), 1.0) * (eps ^ 5.0));
	else
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	end
	return 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[Or[LessEqual[t$95$0, -1e-286], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(5.0 * N[(x / eps), $MachinePrecision] + 1.0), $MachinePrecision] * N[Power[eps, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5}\\

\mathbf{else}:\\
\;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\


\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.00000000000000005e-286 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 98.3%

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

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

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

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

        \[\leadsto \left(\left(4 \cdot \frac{x}{\varepsilon} + \frac{x}{\varepsilon}\right) + 1\right) \cdot {\color{blue}{\varepsilon}}^{5} \]
      4. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot \frac{x}{\varepsilon} + 1\right) \cdot {\varepsilon}^{5} \]
      5. metadata-evalN/A

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

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

        \[\leadsto \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5} \]
      8. lower-pow.f6496.1

        \[\leadsto \mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{\color{blue}{5}} \]
    5. Applied rewrites96.1%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(5 \cdot {x}^{4}\right) \cdot \varepsilon} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq -1 \cdot 10^{-286} \lor \neg \left({\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq 0\right):\\ \;\;\;\;\mathsf{fma}\left(5, \frac{x}{\varepsilon}, 1\right) \cdot {\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}\\ \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-286)
     (* (fma (- eps (* -5.0 x)) eps (* 10.0 (* x x))) (* (* eps eps) eps))
     (if (<= t_0 0.0)
       (* (* 5.0 (pow x 4.0)) eps)
       (* (fma 5.0 x eps) (pow eps 4.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-286) {
		tmp = fma((eps - (-5.0 * x)), eps, (10.0 * (x * x))) * ((eps * eps) * eps);
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	} else {
		tmp = fma(5.0, x, eps) * pow(eps, 4.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-286)
		tmp = Float64(fma(Float64(eps - Float64(-5.0 * x)), eps, Float64(10.0 * Float64(x * x))) * Float64(Float64(eps * eps) * eps));
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	else
		tmp = Float64(fma(5.0, x, eps) * (eps ^ 4.0));
	end
	return 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-286], N[(N[(N[(eps - N[(-5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(5.0 * x + eps), $MachinePrecision] * N[Power[eps, 4.0], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4}\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.7

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    11. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. pow3N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      4. lift-*.f6496.4

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    12. Applied rewrites96.4%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}, \color{blue}{x}, {\varepsilon}^{5}\right) \]
      3. distribute-lft1-inN/A

        \[\leadsto \mathsf{fma}\left(\left(4 + 1\right) \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right) \]
      4. metadata-evalN/A

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(5 \cdot {\varepsilon}^{4}, x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

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

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

        \[\leadsto \left(\varepsilon + 5 \cdot x\right) \cdot {\varepsilon}^{\color{blue}{4}} \]
      3. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot {\varepsilon}^{4} \]
      5. lift-pow.f6495.5

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

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

Alternative 8: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 10 \cdot \left(x \cdot x\right)\\ t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\left(5 \cdot {x}^{4}\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (* 10.0 (* x x)))
        (t_1 (- (pow (+ x eps) 5.0) (pow x 5.0)))
        (t_2 (* (* eps eps) eps)))
   (if (<= t_1 -1e-286)
     (* (fma (- eps (* -5.0 x)) eps t_0) t_2)
     (if (<= t_1 0.0)
       (* (* 5.0 (pow x 4.0)) eps)
       (* (fma (fma 5.0 x eps) eps t_0) t_2)))))
double code(double x, double eps) {
	double t_0 = 10.0 * (x * x);
	double t_1 = pow((x + eps), 5.0) - pow(x, 5.0);
	double t_2 = (eps * eps) * eps;
	double tmp;
	if (t_1 <= -1e-286) {
		tmp = fma((eps - (-5.0 * x)), eps, t_0) * t_2;
	} else if (t_1 <= 0.0) {
		tmp = (5.0 * pow(x, 4.0)) * eps;
	} else {
		tmp = fma(fma(5.0, x, eps), eps, t_0) * t_2;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64(10.0 * Float64(x * x))
	t_1 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	t_2 = Float64(Float64(eps * eps) * eps)
	tmp = 0.0
	if (t_1 <= -1e-286)
		tmp = Float64(fma(Float64(eps - Float64(-5.0 * x)), eps, t_0) * t_2);
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(5.0 * (x ^ 4.0)) * eps);
	else
		tmp = Float64(fma(fma(5.0, x, eps), eps, t_0) * t_2);
	end
	return tmp
end
code[x_, eps_] := Block[{t$95$0 = N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-286], N[(N[(N[(eps - N[(-5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 10 \cdot \left(x \cdot x\right)\\
t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.7

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    11. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. pow3N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      4. lift-*.f6496.4

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    12. Applied rewrites96.4%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites96.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6495.6

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites95.6%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. unpow3N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. pow2N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left({\varepsilon}^{2} \cdot \varepsilon\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      6. lift-*.f6495.4

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    10. Applied rewrites95.4%

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

Alternative 9: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 10 \cdot \left(x \cdot x\right)\\ t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\left(5 \cdot \varepsilon\right) \cdot {x}^{4}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (* 10.0 (* x x)))
        (t_1 (- (pow (+ x eps) 5.0) (pow x 5.0)))
        (t_2 (* (* eps eps) eps)))
   (if (<= t_1 -1e-286)
     (* (fma (- eps (* -5.0 x)) eps t_0) t_2)
     (if (<= t_1 0.0)
       (* (* 5.0 eps) (pow x 4.0))
       (* (fma (fma 5.0 x eps) eps t_0) t_2)))))
double code(double x, double eps) {
	double t_0 = 10.0 * (x * x);
	double t_1 = pow((x + eps), 5.0) - pow(x, 5.0);
	double t_2 = (eps * eps) * eps;
	double tmp;
	if (t_1 <= -1e-286) {
		tmp = fma((eps - (-5.0 * x)), eps, t_0) * t_2;
	} else if (t_1 <= 0.0) {
		tmp = (5.0 * eps) * pow(x, 4.0);
	} else {
		tmp = fma(fma(5.0, x, eps), eps, t_0) * t_2;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64(10.0 * Float64(x * x))
	t_1 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	t_2 = Float64(Float64(eps * eps) * eps)
	tmp = 0.0
	if (t_1 <= -1e-286)
		tmp = Float64(fma(Float64(eps - Float64(-5.0 * x)), eps, t_0) * t_2);
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(5.0 * eps) * (x ^ 4.0));
	else
		tmp = Float64(fma(fma(5.0, x, eps), eps, t_0) * t_2);
	end
	return tmp
end
code[x_, eps_] := Block[{t$95$0 = N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-286], N[(N[(N[(eps - N[(-5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(5.0 * eps), $MachinePrecision] * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 10 \cdot \left(x \cdot x\right)\\
t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.7

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    11. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. pow3N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      4. lift-*.f6496.4

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    12. Applied rewrites96.4%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(\varepsilon + 4 \cdot \varepsilon\right) \cdot \color{blue}{{x}^{4}} \]
      3. distribute-rgt1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot \varepsilon\right) \cdot {\color{blue}{x}}^{4} \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot \varepsilon\right) \cdot {x}^{4} \]
      5. lower-*.f64N/A

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

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

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

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites96.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6495.6

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites95.6%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. unpow3N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. pow2N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left({\varepsilon}^{2} \cdot \varepsilon\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      6. lift-*.f6495.4

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    10. Applied rewrites95.4%

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

Alternative 10: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (or (<= t_0 -1e-286) (not (<= t_0 0.0)))
     (* (fma (fma 5.0 x eps) eps (* 10.0 (* x x))) (* (* eps eps) eps))
     (* (* (* (* 5.0 x) x) (* x x)) eps))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0)) {
		tmp = fma(fma(5.0, x, eps), eps, (10.0 * (x * x))) * ((eps * eps) * eps);
	} else {
		tmp = (((5.0 * x) * x) * (x * x)) * eps;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0))
		tmp = Float64(fma(fma(5.0, x, eps), eps, Float64(10.0 * Float64(x * x))) * Float64(Float64(eps * eps) * eps));
	else
		tmp = Float64(Float64(Float64(Float64(5.0 * x) * x) * Float64(x * x)) * eps);
	end
	return 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[Or[LessEqual[t$95$0, -1e-286], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\


\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.00000000000000005e-286 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 98.3%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.1

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.1%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. unpow3N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. pow2N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left({\varepsilon}^{2} \cdot \varepsilon\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      6. lift-*.f6495.9

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    10. Applied rewrites95.9%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      2. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
      3. pow-prod-upN/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      5. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      6. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      8. lower-*.f6499.9

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    7. Applied rewrites99.9%

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      3. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      4. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      5. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      6. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. associate-*r*N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      8. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      10. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      12. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      13. lift-*.f6499.9

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    9. Applied rewrites99.9%

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      5. lower-*.f6499.9

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    11. Applied rewrites99.9%

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq -1 \cdot 10^{-286} \lor \neg \left({\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq 0\right):\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\ \;\;\;\;\left(\mathsf{fma}\left(x \cdot x, 10, \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (or (<= t_0 -1e-286) (not (<= t_0 0.0)))
     (* (* (fma (* x x) 10.0 (* (fma 5.0 x eps) eps)) (* eps eps)) eps)
     (* (* (* (* 5.0 x) x) (* x x)) eps))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0)) {
		tmp = (fma((x * x), 10.0, (fma(5.0, x, eps) * eps)) * (eps * eps)) * eps;
	} else {
		tmp = (((5.0 * x) * x) * (x * x)) * eps;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if ((t_0 <= -1e-286) || !(t_0 <= 0.0))
		tmp = Float64(Float64(fma(Float64(x * x), 10.0, Float64(fma(5.0, x, eps) * eps)) * Float64(eps * eps)) * eps);
	else
		tmp = Float64(Float64(Float64(Float64(5.0 * x) * x) * Float64(x * x)) * eps);
	end
	return 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[Or[LessEqual[t$95$0, -1e-286], N[Not[LessEqual[t$95$0, 0.0]], $MachinePrecision]], N[(N[(N[(N[(x * x), $MachinePrecision] * 10.0 + N[(N[(5.0 * x + eps), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision] * N[(eps * eps), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-286} \lor \neg \left(t\_0 \leq 0\right):\\
\;\;\;\;\left(\mathsf{fma}\left(x \cdot x, 10, \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\

\mathbf{else}:\\
\;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\


\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.00000000000000005e-286 or 0.0 < (-.f64 (pow.f64 (+.f64 x eps) #s(literal 5 binary64)) (pow.f64 x #s(literal 5 binary64)))

    1. Initial program 98.3%

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.1

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.1%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.1

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.1%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    11. Step-by-step derivation
      1. lift-*.f64N/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      5. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      7. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      8. lift-fma.f64N/A

        \[\leadsto \left(\mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      9. lift-fma.f64N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      12. lift-pow.f64N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      13. pow3N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      14. pow2N/A

        \[\leadsto \left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot \left({\varepsilon}^{2} \cdot \varepsilon\right) \]
      15. associate-*r*N/A

        \[\leadsto \left(\left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{2}\right) \cdot \varepsilon \]
      16. lower-*.f64N/A

        \[\leadsto \left(\left(\left(5 \cdot x + \varepsilon\right) \cdot \varepsilon + 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{2}\right) \cdot \varepsilon \]
    12. Applied rewrites95.8%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      2. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
      3. pow-prod-upN/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      5. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      6. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      8. lower-*.f6499.9

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    7. Applied rewrites99.9%

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      3. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      4. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      5. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      6. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. associate-*r*N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      8. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      10. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      12. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      13. lift-*.f6499.9

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    9. Applied rewrites99.9%

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      5. lower-*.f6499.9

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    11. Applied rewrites99.9%

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq -1 \cdot 10^{-286} \lor \neg \left({\left(x + \varepsilon\right)}^{5} - {x}^{5} \leq 0\right):\\ \;\;\;\;\left(\mathsf{fma}\left(x \cdot x, 10, \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 98.0% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 10 \cdot \left(x \cdot x\right)\\ t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\ \mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\ \mathbf{elif}\;t\_1 \leq 0:\\ \;\;\;\;\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (* 10.0 (* x x)))
        (t_1 (- (pow (+ x eps) 5.0) (pow x 5.0)))
        (t_2 (* (* eps eps) eps)))
   (if (<= t_1 -1e-286)
     (* (fma (- eps (* -5.0 x)) eps t_0) t_2)
     (if (<= t_1 0.0)
       (* (* (* (* 5.0 x) x) (* x x)) eps)
       (* (fma (fma 5.0 x eps) eps t_0) t_2)))))
double code(double x, double eps) {
	double t_0 = 10.0 * (x * x);
	double t_1 = pow((x + eps), 5.0) - pow(x, 5.0);
	double t_2 = (eps * eps) * eps;
	double tmp;
	if (t_1 <= -1e-286) {
		tmp = fma((eps - (-5.0 * x)), eps, t_0) * t_2;
	} else if (t_1 <= 0.0) {
		tmp = (((5.0 * x) * x) * (x * x)) * eps;
	} else {
		tmp = fma(fma(5.0, x, eps), eps, t_0) * t_2;
	}
	return tmp;
}
function code(x, eps)
	t_0 = Float64(10.0 * Float64(x * x))
	t_1 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	t_2 = Float64(Float64(eps * eps) * eps)
	tmp = 0.0
	if (t_1 <= -1e-286)
		tmp = Float64(fma(Float64(eps - Float64(-5.0 * x)), eps, t_0) * t_2);
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(Float64(Float64(5.0 * x) * x) * Float64(x * x)) * eps);
	else
		tmp = Float64(fma(fma(5.0, x, eps), eps, t_0) * t_2);
	end
	return tmp
end
code[x_, eps_] := Block[{t$95$0 = N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(eps * eps), $MachinePrecision] * eps), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-286], N[(N[(N[(eps - N[(-5.0 * x), $MachinePrecision]), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], N[(N[(N[(5.0 * x + eps), $MachinePrecision] * eps + t$95$0), $MachinePrecision] * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 10 \cdot \left(x \cdot x\right)\\
t_1 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\
t_2 := \left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-286}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, t\_0\right) \cdot t\_2\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, t\_0\right) \cdot t\_2\\


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

    1. Initial program 99.8%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites97.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6496.7

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(5 \cdot x + \varepsilon, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      3. fp-cancel-sign-sub-invN/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - \left(\mathsf{neg}\left(5\right)\right) \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      4. metadata-evalN/A

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

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      6. lower-*.f6496.7

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    10. Applied rewrites96.7%

      \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    11. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. pow3N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      4. lift-*.f6496.4

        \[\leadsto \mathsf{fma}\left(\varepsilon - -5 \cdot x, \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    12. Applied rewrites96.4%

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

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

    1. Initial program 88.1%

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

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

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

        \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
      3. distribute-lft1-inN/A

        \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
      4. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      5. lower-*.f64N/A

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      6. lower-pow.f64100.0

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. Applied rewrites100.0%

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

        \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
      2. metadata-evalN/A

        \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
      3. pow-prod-upN/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      5. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      6. lower-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. unpow2N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      8. lower-*.f6499.9

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    7. Applied rewrites99.9%

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      3. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      4. lift-*.f64N/A

        \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      5. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
      6. pow2N/A

        \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
      7. associate-*r*N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      8. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      9. lower-*.f64N/A

        \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      10. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      11. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
      12. pow2N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      13. lift-*.f6499.9

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    9. Applied rewrites99.9%

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    10. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      2. lift-*.f64N/A

        \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      3. associate-*r*N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      4. lower-*.f64N/A

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
      5. lower-*.f6499.9

        \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    11. Applied rewrites99.9%

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]

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

    1. Initial program 96.9%

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

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

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

        \[\leadsto \mathsf{fma}\left(4 \cdot {\varepsilon}^{4} + \left(x \cdot \left(4 \cdot {\varepsilon}^{3} + \varepsilon \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)\right) + {\varepsilon}^{4}\right), \color{blue}{x}, {\varepsilon}^{5}\right) \]
    5. Applied rewrites96.2%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left({\varepsilon}^{4}, 4, \mathsf{fma}\left(\mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot 6, \varepsilon, {\varepsilon}^{3} \cdot 4\right), x, {\varepsilon}^{4}\right)\right), x, {\varepsilon}^{5}\right)} \]
    6. Taylor expanded in eps around 0

      \[\leadsto {\varepsilon}^{3} \cdot \color{blue}{\left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto \left(10 \cdot {x}^{2} + \varepsilon \cdot \left(\varepsilon + 5 \cdot x\right)\right) \cdot {\varepsilon}^{\color{blue}{3}} \]
      3. +-commutativeN/A

        \[\leadsto \left(\varepsilon \cdot \left(\varepsilon + 5 \cdot x\right) + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      4. *-commutativeN/A

        \[\leadsto \left(\left(\varepsilon + 5 \cdot x\right) \cdot \varepsilon + 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      5. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(\varepsilon + 5 \cdot x, \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      6. +-commutativeN/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot {x}^{2}\right) \cdot {\varepsilon}^{3} \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      11. lift-pow.f6495.6

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
    8. Applied rewrites95.6%

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{{\varepsilon}^{3}} \]
    9. Step-by-step derivation
      1. lift-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot {\varepsilon}^{3} \]
      2. unpow3N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      3. pow2N/A

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

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left({\varepsilon}^{2} \cdot \varepsilon\right) \]
      5. pow2N/A

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
      6. lift-*.f6495.4

        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(5, x, \varepsilon\right), \varepsilon, 10 \cdot \left(x \cdot x\right)\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \varepsilon\right) \]
    10. Applied rewrites95.4%

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

Alternative 13: 82.8% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \end{array} \]
(FPCore (x eps) :precision binary64 (* (* (* (* 5.0 x) x) (* x x)) eps))
double code(double x, double eps) {
	return (((5.0 * x) * x) * (x * x)) * eps;
}
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) * x) * (x * x)) * eps
end function
public static double code(double x, double eps) {
	return (((5.0 * x) * x) * (x * x)) * eps;
}
def code(x, eps):
	return (((5.0 * x) * x) * (x * x)) * eps
function code(x, eps)
	return Float64(Float64(Float64(Float64(5.0 * x) * x) * Float64(x * x)) * eps)
end
function tmp = code(x, eps)
	tmp = (((5.0 * x) * x) * (x * x)) * eps;
end
code[x_, eps_] := N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon
\end{array}
Derivation
  1. Initial program 90.1%

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

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

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

      \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
    3. distribute-lft1-inN/A

      \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
    4. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. lower-*.f64N/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    6. lower-pow.f6482.2

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
  5. Applied rewrites82.2%

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

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    2. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
    3. pow-prod-upN/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    4. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    5. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    6. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. lower-*.f6482.1

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  7. Applied rewrites82.1%

    \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    2. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    3. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    4. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    5. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    6. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. associate-*r*N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    8. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    9. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    10. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    11. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    12. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    13. lift-*.f6482.2

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  9. Applied rewrites82.2%

    \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  10. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    2. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    3. associate-*r*N/A

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    4. lower-*.f64N/A

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    5. lower-*.f6482.2

      \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  11. Applied rewrites82.2%

    \[\leadsto \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  12. Add Preprocessing

Alternative 14: 82.8% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* (* (* x x) 5.0) (* (* x x) eps)))
double code(double x, double eps) {
	return ((x * x) * 5.0) * ((x * x) * eps);
}
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 * x) * 5.0d0) * ((x * x) * eps)
end function
public static double code(double x, double eps) {
	return ((x * x) * 5.0) * ((x * x) * eps);
}
def code(x, eps):
	return ((x * x) * 5.0) * ((x * x) * eps)
function code(x, eps)
	return Float64(Float64(Float64(x * x) * 5.0) * Float64(Float64(x * x) * eps))
end
function tmp = code(x, eps)
	tmp = ((x * x) * 5.0) * ((x * x) * eps);
end
code[x_, eps_] := N[(N[(N[(x * x), $MachinePrecision] * 5.0), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] * eps), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right)
\end{array}
Derivation
  1. Initial program 90.1%

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

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

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

      \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
    3. distribute-lft1-inN/A

      \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
    4. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. lower-*.f64N/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    6. lower-pow.f6482.2

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
  5. Applied rewrites82.2%

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

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    2. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
    3. pow-prod-upN/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    4. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    5. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    6. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. lower-*.f6482.1

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  7. Applied rewrites82.1%

    \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    2. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    3. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    4. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    5. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    6. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. associate-*r*N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    8. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    9. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    10. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    11. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    12. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    13. lift-*.f6482.2

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  9. Applied rewrites82.2%

    \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  10. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\varepsilon} \]
    2. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    3. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    4. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    5. associate-*l*N/A

      \[\leadsto \left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left({x}^{2} \cdot \varepsilon\right)} \]
    6. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left({x}^{2} \cdot \varepsilon\right)} \]
    7. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(x \cdot x\right)\right) \cdot \left({x}^{\color{blue}{2}} \cdot \varepsilon\right) \]
    8. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(\color{blue}{{x}^{2}} \cdot \varepsilon\right) \]
    9. pow2N/A

      \[\leadsto \left(5 \cdot {x}^{2}\right) \cdot \left({x}^{\color{blue}{2}} \cdot \varepsilon\right) \]
    10. *-commutativeN/A

      \[\leadsto \left({x}^{2} \cdot 5\right) \cdot \left(\color{blue}{{x}^{2}} \cdot \varepsilon\right) \]
    11. lower-*.f64N/A

      \[\leadsto \left({x}^{2} \cdot 5\right) \cdot \left(\color{blue}{{x}^{2}} \cdot \varepsilon\right) \]
    12. pow2N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left({\color{blue}{x}}^{2} \cdot \varepsilon\right) \]
    13. lift-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left({\color{blue}{x}}^{2} \cdot \varepsilon\right) \]
    14. lower-*.f64N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left({x}^{2} \cdot \color{blue}{\varepsilon}\right) \]
    15. pow2N/A

      \[\leadsto \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right) \]
    16. lift-*.f6482.2

      \[\leadsto \left(\left(x \cdot x\right) \cdot 5\right) \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right) \]
  11. Applied rewrites82.2%

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

Alternative 15: 82.8% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \end{array} \]
(FPCore (x eps) :precision binary64 (* (* (* 5.0 (* x x)) (* x x)) eps))
double code(double x, double eps) {
	return ((5.0 * (x * x)) * (x * x)) * eps;
}
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 * x)) * (x * x)) * eps
end function
public static double code(double x, double eps) {
	return ((5.0 * (x * x)) * (x * x)) * eps;
}
def code(x, eps):
	return ((5.0 * (x * x)) * (x * x)) * eps
function code(x, eps)
	return Float64(Float64(Float64(5.0 * Float64(x * x)) * Float64(x * x)) * eps)
end
function tmp = code(x, eps)
	tmp = ((5.0 * (x * x)) * (x * x)) * eps;
end
code[x_, eps_] := N[(N[(N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}

\\
\left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon
\end{array}
Derivation
  1. Initial program 90.1%

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

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

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

      \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
    3. distribute-lft1-inN/A

      \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
    4. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. lower-*.f64N/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    6. lower-pow.f6482.2

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
  5. Applied rewrites82.2%

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

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    2. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
    3. pow-prod-upN/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    4. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    5. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    6. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. lower-*.f6482.1

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  7. Applied rewrites82.1%

    \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    2. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    3. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    4. lift-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    5. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    6. pow2N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. associate-*r*N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    8. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    9. lower-*.f64N/A

      \[\leadsto \left(\left(5 \cdot {x}^{2}\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    10. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    11. lift-*.f64N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot {x}^{2}\right) \cdot \varepsilon \]
    12. pow2N/A

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
    13. lift-*.f6482.2

      \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  9. Applied rewrites82.2%

    \[\leadsto \left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \]
  10. Add Preprocessing

Alternative 16: 82.8% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \end{array} \]
(FPCore (x eps) :precision binary64 (* (* 5.0 (* (* x x) (* x x))) eps))
double code(double x, double eps) {
	return (5.0 * ((x * x) * (x * x))) * eps;
}
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 * x) * (x * x))) * eps
end function
public static double code(double x, double eps) {
	return (5.0 * ((x * x) * (x * x))) * eps;
}
def code(x, eps):
	return (5.0 * ((x * x) * (x * x))) * eps
function code(x, eps)
	return Float64(Float64(5.0 * Float64(Float64(x * x) * Float64(x * x))) * eps)
end
function tmp = code(x, eps)
	tmp = (5.0 * ((x * x) * (x * x))) * eps;
end
code[x_, eps_] := N[(N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}

\\
\left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon
\end{array}
Derivation
  1. Initial program 90.1%

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

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

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

      \[\leadsto \left(4 \cdot {x}^{4} + {x}^{4}\right) \cdot \color{blue}{\varepsilon} \]
    3. distribute-lft1-inN/A

      \[\leadsto \left(\left(4 + 1\right) \cdot {x}^{4}\right) \cdot \varepsilon \]
    4. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    5. lower-*.f64N/A

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    6. lower-pow.f6482.2

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
  5. Applied rewrites82.2%

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

      \[\leadsto \left(5 \cdot {x}^{4}\right) \cdot \varepsilon \]
    2. metadata-evalN/A

      \[\leadsto \left(5 \cdot {x}^{\left(2 + 2\right)}\right) \cdot \varepsilon \]
    3. pow-prod-upN/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    4. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left({x}^{2} \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    5. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    6. lower-*.f64N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot {x}^{2}\right)\right) \cdot \varepsilon \]
    7. unpow2N/A

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
    8. lower-*.f6482.1

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  7. Applied rewrites82.1%

    \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  8. Add Preprocessing

Reproduce

?
herbie shell --seed 2025053 
(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)))