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

Percentage Accurate: 88.4% → 99.4%
Time: 10.6s
Alternatives: 13
Speedup: 0.5×

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);
}
real(8) function code(x, eps)
    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 13 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.4% 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);
}
real(8) function code(x, eps)
    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: 99.4% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 98.8%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \color{blue}{{\left(x + \varepsilon\right)}^{5} - {x}^{5}} \]
      2. pow-lowering-pow.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto {\left(x + \varepsilon\right)}^{5} - \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) \]
      11. *-lowering-*.f6498.9

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

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

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

    1. Initial program 83.9%

      \[{\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 + \left(-1 \cdot \frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x} + 4 \cdot \varepsilon\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

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

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

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

        \[\leadsto {x}^{4} \cdot \left(\left(\varepsilon + 4 \cdot \varepsilon\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}\right)\right)}\right) \]
      6. unsub-negN/A

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

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

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

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

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

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

        \[\leadsto {x}^{4} \cdot \left(\varepsilon \cdot 5 - \color{blue}{\frac{-4 \cdot {\varepsilon}^{2} + -1 \cdot \left(2 \cdot {\varepsilon}^{2} + 4 \cdot {\varepsilon}^{2}\right)}{x}}\right) \]
    5. Simplified99.9%

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

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

Alternative 2: 99.4% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 98.8%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \color{blue}{{\left(x + \varepsilon\right)}^{5} - {x}^{5}} \]
      2. pow-lowering-pow.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto {\left(x + \varepsilon\right)}^{5} - \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) \]
      11. *-lowering-*.f6498.9

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

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

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

    1. Initial program 83.9%

      \[{\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. distribute-rgt-inN/A

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

        \[\leadsto \varepsilon \cdot {x}^{4} + \color{blue}{\left(\varepsilon \cdot 4\right)} \cdot {x}^{4} \]
      3. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

Alternative 3: 98.3% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(x + \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot 10\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}\\

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


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

    1. Initial program 99.5%

      \[{\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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
      2. +-commutativeN/A

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{5 \cdot x + \varepsilon}}{\varepsilon} \]
      3. accelerator-lowering-fma.f6496.0

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)}}{\varepsilon} \]
    8. Simplified96.0%

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

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

    1. Initial program 83.9%

      \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
      3. associate-+l+N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) + \left(\left(5 \cdot {x}^{4}\right) \cdot \left(5 \cdot {x}^{4}\right) - \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(5 \cdot {x}^{4}\right)\right)}{{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right)}^{3} + {\left(5 \cdot {x}^{4}\right)}^{3}}}} \]
    7. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

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

Alternative 4: 98.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(x + \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot 10\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}\\

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


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

    1. Initial program 99.5%

      \[{\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 \color{blue}{\left(4 \cdot {\varepsilon}^{4} + {\varepsilon}^{4}\right) \cdot x} + {\varepsilon}^{5} \]
      2. distribute-lft1-inN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {\varepsilon}^{4} \cdot \color{blue}{\left(5 \cdot x + \varepsilon\right)} \]
      11. accelerator-lowering-fma.f6495.6

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

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

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

    1. Initial program 83.9%

      \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
      3. associate-+l+N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) + \left(\left(5 \cdot {x}^{4}\right) \cdot \left(5 \cdot {x}^{4}\right) - \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(5 \cdot {x}^{4}\right)\right)}{{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right)}^{3} + {\left(5 \cdot {x}^{4}\right)}^{3}}}} \]
    7. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.7%

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

Alternative 5: 98.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(x + \varepsilon\right) \cdot \left(\left(x \cdot x\right) \cdot 10\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}\\

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


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

    1. Initial program 99.5%

      \[{\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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
      2. +-commutativeN/A

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{5 \cdot x + \varepsilon}}{\varepsilon} \]
      3. accelerator-lowering-fma.f6496.0

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)}}{\varepsilon} \]
    8. Simplified96.0%

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

        \[\leadsto \color{blue}{\frac{5 \cdot x + \varepsilon}{\varepsilon} \cdot {\varepsilon}^{5}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(5 \cdot x + \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)} \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \color{blue}{\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      15. *-lowering-*.f6495.2

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right) \]
    10. Applied egg-rr95.2%

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

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

    1. Initial program 83.9%

      \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
      3. associate-+l+N/A

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) + \left(\left(5 \cdot {x}^{4}\right) \cdot \left(5 \cdot {x}^{4}\right) - \left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \cdot \left(5 \cdot {x}^{4}\right)\right)}{{\left(\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right)}^{3} + {\left(5 \cdot {x}^{4}\right)}^{3}}}} \]
    7. Applied egg-rr99.5%

      \[\leadsto \color{blue}{\frac{\varepsilon}{\frac{1}{\mathsf{fma}\left(\varepsilon, \left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right), 5 \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)\right)}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

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

Alternative 6: 98.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;x \cdot \left(x \cdot \mathsf{fma}\left(5, \varepsilon \cdot \left(x \cdot x\right), 10 \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(x + \varepsilon\right)\right)\right)\right)\right)\\

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


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

    1. Initial program 99.5%

      \[{\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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
      2. +-commutativeN/A

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{5 \cdot x + \varepsilon}}{\varepsilon} \]
      3. accelerator-lowering-fma.f6496.0

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)}}{\varepsilon} \]
    8. Simplified96.0%

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

        \[\leadsto \color{blue}{\frac{5 \cdot x + \varepsilon}{\varepsilon} \cdot {\varepsilon}^{5}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(5 \cdot x + \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)} \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \color{blue}{\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      15. *-lowering-*.f6495.2

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right) \]
    10. Applied egg-rr95.2%

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

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

    1. Initial program 83.9%

      \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
      3. associate-+l+N/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(\color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)}, 5, \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \]
      8. associate-*l*N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(\color{blue}{x \cdot \left(x \cdot \left(x \cdot x\right)\right)}, 5, \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \]
      9. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)}, 5, \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right), 5, \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \color{blue}{\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot 10 + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)}\right) \]
      13. associate-*l*N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \left(\color{blue}{x \cdot \left(\left(x \cdot x\right) \cdot 10\right)} + \varepsilon \cdot \left(\left(x \cdot x\right) \cdot 10\right)\right)\right) \]
      14. distribute-rgt-outN/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right)\right)}\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \color{blue}{\left(\left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right)\right)}\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \left(\color{blue}{\left(\left(x \cdot x\right) \cdot 10\right)} \cdot \left(x + \varepsilon\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \left(\left(\color{blue}{\left(x \cdot x\right)} \cdot 10\right) \cdot \left(x + \varepsilon\right)\right)\right) \]
      18. +-lowering-+.f6499.4

        \[\leadsto \varepsilon \cdot \mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \left(\left(\left(x \cdot x\right) \cdot 10\right) \cdot \color{blue}{\left(x + \varepsilon\right)}\right)\right) \]
    7. Applied egg-rr99.4%

      \[\leadsto \varepsilon \cdot \color{blue}{\mathsf{fma}\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right), 5, \varepsilon \cdot \left(\left(\left(x \cdot x\right) \cdot 10\right) \cdot \left(x + \varepsilon\right)\right)\right)} \]
    8. Taylor expanded in x around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \mathsf{fma}\left(5, \varepsilon \cdot \left(x \cdot x\right), 10 \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot \left(\varepsilon + x\right)\right)\right)\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.6%

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

Alternative 7: 98.2% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 10, x \cdot 5\right)\right)\\

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


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

    1. Initial program 99.5%

      \[{\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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
      2. +-commutativeN/A

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{5 \cdot x + \varepsilon}}{\varepsilon} \]
      3. accelerator-lowering-fma.f6496.0

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)}}{\varepsilon} \]
    8. Simplified96.0%

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

        \[\leadsto \color{blue}{\frac{5 \cdot x + \varepsilon}{\varepsilon} \cdot {\varepsilon}^{5}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(5 \cdot x + \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)} \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \color{blue}{\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      15. *-lowering-*.f6495.2

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right) \]
    10. Applied egg-rr95.2%

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

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

    1. Initial program 83.9%

      \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right) + {x}^{4}\right)\right)} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
      3. associate-+l+N/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \varepsilon \cdot \left(\color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} \cdot \left(5 \cdot x + 10 \cdot \varepsilon\right)\right) \]
      9. unpow2N/A

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

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

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

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

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

        \[\leadsto \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(\color{blue}{\varepsilon \cdot 10} + 5 \cdot x\right)\right) \]
      15. accelerator-lowering-fma.f64N/A

        \[\leadsto \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\mathsf{fma}\left(\varepsilon, 10, 5 \cdot x\right)}\right) \]
      16. *-lowering-*.f6499.4

        \[\leadsto \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \mathsf{fma}\left(\varepsilon, 10, \color{blue}{5 \cdot x}\right)\right) \]
    8. Simplified99.4%

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

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

Alternative 8: 98.4% accurate, 0.5× speedup?

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

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

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

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


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

    1. Initial program 98.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

      \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
    7. Step-by-step derivation
      1. /-lowering-/.f64N/A

        \[\leadsto {\varepsilon}^{5} \cdot \color{blue}{\frac{\varepsilon + 5 \cdot x}{\varepsilon}} \]
      2. +-commutativeN/A

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{5 \cdot x + \varepsilon}}{\varepsilon} \]
      3. accelerator-lowering-fma.f6494.3

        \[\leadsto {\varepsilon}^{5} \cdot \frac{\color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)}}{\varepsilon} \]
    8. Simplified94.3%

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

        \[\leadsto \color{blue}{\frac{5 \cdot x + \varepsilon}{\varepsilon} \cdot {\varepsilon}^{5}} \]
      2. div-invN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(5 \cdot x + \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      12. accelerator-lowering-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(5, x, \varepsilon\right)} \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \color{blue}{\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \left(\varepsilon \cdot \varepsilon\right)\right)} \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \cdot \left(\varepsilon \cdot \varepsilon\right)\right) \]
      15. *-lowering-*.f6493.5

        \[\leadsto \mathsf{fma}\left(5, x, \varepsilon\right) \cdot \left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{\left(\varepsilon \cdot \varepsilon\right)}\right) \]
    10. Applied egg-rr93.5%

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

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

    1. Initial program 83.9%

      \[{\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. distribute-rgt-inN/A

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

        \[\leadsto \varepsilon \cdot {x}^{4} + \color{blue}{\left(\varepsilon \cdot 4\right)} \cdot {x}^{4} \]
      3. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)} \]
      6. associate-*r*N/A

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

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

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

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

        \[\leadsto \left(\left(\varepsilon \cdot 5\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} \]
      11. *-lowering-*.f6499.8

        \[\leadsto \left(\left(\varepsilon \cdot 5\right) \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
    7. Applied egg-rr99.8%

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(x \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right)\right)} \cdot \left(5 \cdot x\right) \]
      8. associate-*r*N/A

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

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

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

        \[\leadsto \left(x \cdot \color{blue}{\left(\left(\varepsilon \cdot x\right) \cdot x\right)}\right) \cdot \left(5 \cdot x\right) \]
      12. associate-*r*N/A

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

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

        \[\leadsto \left(x \cdot \left(\varepsilon \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \cdot \left(5 \cdot x\right) \]
      15. *-lowering-*.f6499.9

        \[\leadsto \left(x \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(5 \cdot x\right)} \]
    9. Applied egg-rr99.9%

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

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

Alternative 9: 82.5% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot 5\right) \cdot \left(x \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* (* x 5.0) (* x (* eps (* x x)))))
double code(double x, double eps) {
	return (x * 5.0) * (x * (eps * (x * x)));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (x * 5.0d0) * (x * (eps * (x * x)))
end function
public static double code(double x, double eps) {
	return (x * 5.0) * (x * (eps * (x * x)));
}
def code(x, eps):
	return (x * 5.0) * (x * (eps * (x * x)))
function code(x, eps)
	return Float64(Float64(x * 5.0) * Float64(x * Float64(eps * Float64(x * x))))
end
function tmp = code(x, eps)
	tmp = (x * 5.0) * (x * (eps * (x * x)));
end
code[x_, eps_] := N[(N[(x * 5.0), $MachinePrecision] * N[(x * N[(eps * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\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. distribute-rgt-inN/A

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

      \[\leadsto \varepsilon \cdot {x}^{4} + \color{blue}{\left(\varepsilon \cdot 4\right)} \cdot {x}^{4} \]
    3. associate-*r*N/A

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(5 \cdot {x}^{4}\right)} \]
    10. pow-lowering-pow.f6481.6

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\varepsilon \cdot 5\right) \cdot \left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)} \]
    6. associate-*r*N/A

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

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

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

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

      \[\leadsto \left(\left(\varepsilon \cdot 5\right) \cdot x\right) \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)} \]
    11. *-lowering-*.f6481.5

      \[\leadsto \left(\left(\varepsilon \cdot 5\right) \cdot x\right) \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \]
  7. Applied egg-rr81.5%

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(x \cdot \left(\left(x \cdot x\right) \cdot \varepsilon\right)\right)} \cdot \left(5 \cdot x\right) \]
    8. associate-*r*N/A

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

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

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

      \[\leadsto \left(x \cdot \color{blue}{\left(\left(\varepsilon \cdot x\right) \cdot x\right)}\right) \cdot \left(5 \cdot x\right) \]
    12. associate-*r*N/A

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

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

      \[\leadsto \left(x \cdot \left(\varepsilon \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \cdot \left(5 \cdot x\right) \]
    15. *-lowering-*.f6481.5

      \[\leadsto \left(x \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)\right) \cdot \color{blue}{\left(5 \cdot x\right)} \]
  9. Applied egg-rr81.5%

    \[\leadsto \color{blue}{\left(x \cdot \left(\varepsilon \cdot \left(x \cdot x\right)\right)\right) \cdot \left(5 \cdot x\right)} \]
  10. Final simplification81.5%

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

Alternative 10: 82.5% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(x \cdot \varepsilon\right) \cdot \left(5 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* (* x eps) (* 5.0 (* x (* x x)))))
double code(double x, double eps) {
	return (x * eps) * (5.0 * (x * (x * x)));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (x * eps) * (5.0d0 * (x * (x * x)))
end function
public static double code(double x, double eps) {
	return (x * eps) * (5.0 * (x * (x * x)));
}
def code(x, eps):
	return (x * eps) * (5.0 * (x * (x * x)))
function code(x, eps)
	return Float64(Float64(x * eps) * Float64(5.0 * Float64(x * Float64(x * x))))
end
function tmp = code(x, eps)
	tmp = (x * eps) * (5.0 * (x * (x * x)));
end
code[x_, eps_] := N[(N[(x * eps), $MachinePrecision] * N[(5.0 * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\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. distribute-rgt-inN/A

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

      \[\leadsto \varepsilon \cdot {x}^{4} + \color{blue}{\left(\varepsilon \cdot 4\right)} \cdot {x}^{4} \]
    3. associate-*r*N/A

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(5 \cdot {x}^{4}\right)} \]
    10. pow-lowering-pow.f6481.6

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\varepsilon \cdot x\right) \cdot \left(5 \cdot \color{blue}{\left(x \cdot \left(x \cdot x\right)\right)}\right) \]
    13. *-lowering-*.f6481.5

      \[\leadsto \left(\varepsilon \cdot x\right) \cdot \left(5 \cdot \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
  7. Applied egg-rr81.5%

    \[\leadsto \color{blue}{\left(\varepsilon \cdot x\right) \cdot \left(5 \cdot \left(x \cdot \left(x \cdot x\right)\right)\right)} \]
  8. Final simplification81.5%

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

Alternative 11: 82.5% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot 5\right)\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* eps (* (* x (* x x)) (* x 5.0))))
double code(double x, double eps) {
	return eps * ((x * (x * x)) * (x * 5.0));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = eps * ((x * (x * x)) * (x * 5.0d0))
end function
public static double code(double x, double eps) {
	return eps * ((x * (x * x)) * (x * 5.0));
}
def code(x, eps):
	return eps * ((x * (x * x)) * (x * 5.0))
function code(x, eps)
	return Float64(eps * Float64(Float64(x * Float64(x * x)) * Float64(x * 5.0)))
end
function tmp = code(x, eps)
	tmp = eps * ((x * (x * x)) * (x * 5.0));
end
code[x_, eps_] := N[(eps * N[(N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision] * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\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. distribute-rgt-inN/A

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

      \[\leadsto \varepsilon \cdot {x}^{4} + \color{blue}{\left(\varepsilon \cdot 4\right)} \cdot {x}^{4} \]
    3. associate-*r*N/A

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(5 \cdot {x}^{4}\right)} \]
    10. pow-lowering-pow.f6481.6

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \left(\left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(5 \cdot x\right)\right) \]
    12. *-lowering-*.f6481.5

      \[\leadsto \varepsilon \cdot \left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \color{blue}{\left(5 \cdot x\right)}\right) \]
  7. Applied egg-rr81.5%

    \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(5 \cdot x\right)\right)} \]
  8. Final simplification81.5%

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

Alternative 12: 82.5% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* eps (* (* x x) (* 5.0 (* x x)))))
double code(double x, double eps) {
	return eps * ((x * x) * (5.0 * (x * x)));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = eps * ((x * x) * (5.0d0 * (x * x)))
end function
public static double code(double x, double eps) {
	return eps * ((x * x) * (5.0 * (x * x)));
}
def code(x, eps):
	return eps * ((x * x) * (5.0 * (x * x)))
function code(x, eps)
	return Float64(eps * Float64(Float64(x * x) * Float64(5.0 * Float64(x * x))))
end
function tmp = code(x, eps)
	tmp = eps * ((x * x) * (5.0 * (x * x)));
end
code[x_, eps_] := N[(eps * N[(N[(x * x), $MachinePrecision] * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right) + {x}^{4}\right)\right)} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
    3. associate-+l+N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left({x}^{3} \cdot \left(5 \cdot x\right)\right)} \]
    6. unpow3N/A

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

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

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

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

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

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

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

      \[\leadsto \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(5 \cdot \left(x \cdot x\right)\right)}\right) \]
    14. unpow2N/A

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

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

      \[\leadsto \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
    17. *-lowering-*.f6481.5

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

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

Alternative 13: 71.0% accurate, 8.0× speedup?

\[\begin{array}{l} \\ 10 \cdot \left(\varepsilon \cdot \left(x \cdot \left(\varepsilon \cdot \left(x \cdot \varepsilon\right)\right)\right)\right) \end{array} \]
(FPCore (x eps) :precision binary64 (* 10.0 (* eps (* x (* eps (* x eps))))))
double code(double x, double eps) {
	return 10.0 * (eps * (x * (eps * (x * eps))));
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = 10.0d0 * (eps * (x * (eps * (x * eps))))
end function
public static double code(double x, double eps) {
	return 10.0 * (eps * (x * (eps * (x * eps))));
}
def code(x, eps):
	return 10.0 * (eps * (x * (eps * (x * eps))))
function code(x, eps)
	return Float64(10.0 * Float64(eps * Float64(x * Float64(eps * Float64(x * eps)))))
end
function tmp = code(x, eps)
	tmp = 10.0 * (eps * (x * (eps * (x * eps))));
end
code[x_, eps_] := N[(10.0 * N[(eps * N[(x * N[(eps * N[(x * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

    \[{\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} + \left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right)\right)} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(\varepsilon \cdot \left(4 \cdot {x}^{3} + \left(\varepsilon \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right) + x \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)\right)\right) + {x}^{4}\right) + 4 \cdot {x}^{4}\right)} \]
    3. associate-+l+N/A

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

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

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

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

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

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

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

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

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

      \[\leadsto 10 \cdot \color{blue}{\left(\varepsilon \cdot \left({\varepsilon}^{2} \cdot {x}^{2}\right)\right)} \]
    6. unpow2N/A

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

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

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

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

      \[\leadsto 10 \cdot \left(\varepsilon \cdot \left(x \cdot \left(\color{blue}{\left(\varepsilon \cdot \varepsilon\right)} \cdot x\right)\right)\right) \]
    11. associate-*l*N/A

      \[\leadsto 10 \cdot \left(\varepsilon \cdot \left(x \cdot \color{blue}{\left(\varepsilon \cdot \left(\varepsilon \cdot x\right)\right)}\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto 10 \cdot \left(\varepsilon \cdot \left(x \cdot \color{blue}{\left(\varepsilon \cdot \left(\varepsilon \cdot x\right)\right)}\right)\right) \]
    13. *-lowering-*.f6468.6

      \[\leadsto 10 \cdot \left(\varepsilon \cdot \left(x \cdot \left(\varepsilon \cdot \color{blue}{\left(\varepsilon \cdot x\right)}\right)\right)\right) \]
  8. Simplified68.6%

    \[\leadsto \color{blue}{10 \cdot \left(\varepsilon \cdot \left(x \cdot \left(\varepsilon \cdot \left(\varepsilon \cdot x\right)\right)\right)\right)} \]
  9. Final simplification68.6%

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

Reproduce

?
herbie shell --seed 2024204 
(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)))