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

Percentage Accurate: 88.5% → 97.7%
Time: 9.1s
Alternatives: 9
Speedup: 2.0×

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 9 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.5% 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: 97.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{-41}:\\ \;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{elif}\;x \leq 2.65 \cdot 10^{-39}:\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(4, {x}^{3}, x \cdot \left(\left(x \cdot x\right) \cdot 6\right)\right), \mathsf{fma}\left(\varepsilon, {x}^{4} \cdot 5, {\varepsilon}^{3} \cdot \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -4.4e-41)
   (+ (* (* eps (* eps 10.0)) (pow x 3.0)) (* (pow x 4.0) (* eps 5.0)))
   (if (<= x 2.65e-39)
     (- (pow (+ x eps) 5.0) (pow x 5.0))
     (fma
      (* eps eps)
      (fma 4.0 (pow x 3.0) (* x (* (* x x) 6.0)))
      (fma eps (* (pow x 4.0) 5.0) (* (pow eps 3.0) (* 10.0 (* x x))))))))
double code(double x, double eps) {
	double tmp;
	if (x <= -4.4e-41) {
		tmp = ((eps * (eps * 10.0)) * pow(x, 3.0)) + (pow(x, 4.0) * (eps * 5.0));
	} else if (x <= 2.65e-39) {
		tmp = pow((x + eps), 5.0) - pow(x, 5.0);
	} else {
		tmp = fma((eps * eps), fma(4.0, pow(x, 3.0), (x * ((x * x) * 6.0))), fma(eps, (pow(x, 4.0) * 5.0), (pow(eps, 3.0) * (10.0 * (x * x)))));
	}
	return tmp;
}
function code(x, eps)
	tmp = 0.0
	if (x <= -4.4e-41)
		tmp = Float64(Float64(Float64(eps * Float64(eps * 10.0)) * (x ^ 3.0)) + Float64((x ^ 4.0) * Float64(eps * 5.0)));
	elseif (x <= 2.65e-39)
		tmp = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0));
	else
		tmp = fma(Float64(eps * eps), fma(4.0, (x ^ 3.0), Float64(x * Float64(Float64(x * x) * 6.0))), fma(eps, Float64((x ^ 4.0) * 5.0), Float64((eps ^ 3.0) * Float64(10.0 * Float64(x * x)))));
	end
	return tmp
end
code[x_, eps_] := If[LessEqual[x, -4.4e-41], N[(N[(N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision] * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.65e-39], N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision], N[(N[(eps * eps), $MachinePrecision] * N[(4.0 * N[Power[x, 3.0], $MachinePrecision] + N[(x * N[(N[(x * x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision] + N[(N[Power[eps, 3.0], $MachinePrecision] * N[(10.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-41}:\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\

\mathbf{elif}\;x \leq 2.65 \cdot 10^{-39}:\\
\;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.4e-41

    1. Initial program 30.0%

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

      \[\leadsto \color{blue}{\left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4} + \left(2 \cdot {\varepsilon}^{2} + 8 \cdot {\varepsilon}^{2}\right) \cdot {x}^{3}} \]
    3. Step-by-step derivation
      1. +-commutative99.7%

        \[\leadsto \color{blue}{\left(2 \cdot {\varepsilon}^{2} + 8 \cdot {\varepsilon}^{2}\right) \cdot {x}^{3} + \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}} \]
      2. fma-def99.7%

        \[\leadsto \color{blue}{\mathsf{fma}\left(2 \cdot {\varepsilon}^{2} + 8 \cdot {\varepsilon}^{2}, {x}^{3}, \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}\right)} \]
      3. distribute-rgt-out99.7%

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

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

        \[\leadsto \mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{10}, {x}^{3}, \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}\right) \]
      6. associate-*l*99.7%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\varepsilon \cdot \left(\varepsilon \cdot 10\right)}, {x}^{3}, \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}\right) \]
      7. distribute-lft1-in99.7%

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right), {x}^{3}, \color{blue}{\left(\left(4 + 1\right) \cdot \varepsilon\right)} \cdot {x}^{4}\right) \]
      8. metadata-eval99.7%

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right), {x}^{3}, \left(\color{blue}{5} \cdot \varepsilon\right) \cdot {x}^{4}\right) \]
      9. *-commutative99.7%

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

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

        \[\leadsto \color{blue}{\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + \left(\varepsilon \cdot 5\right) \cdot {x}^{4}} \]
      2. *-commutative99.7%

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

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

    if -4.4e-41 < x < 2.65000000000000002e-39

    1. Initial program 99.1%

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

    if 2.65000000000000002e-39 < x

    1. Initial program 22.1%

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

      \[\leadsto \color{blue}{{\varepsilon}^{2} \cdot \left(4 \cdot {x}^{3} + \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right) \cdot x\right) + \left(\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right) + {\varepsilon}^{3} \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right)\right)} \]
    3. Step-by-step derivation
      1. fma-def99.5%

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(4, {x}^{3}, x \cdot \left(\left(x \cdot x\right) \cdot 6\right)\right), \mathsf{fma}\left(\varepsilon, \color{blue}{\left(4 + 1\right) \cdot {x}^{4}}, {\varepsilon}^{3} \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right)\right)\right) \]
      10. metadata-eval99.5%

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(4, {x}^{3}, x \cdot \left(\left(x \cdot x\right) \cdot 6\right)\right), \mathsf{fma}\left(\varepsilon, \color{blue}{5} \cdot {x}^{4}, {\varepsilon}^{3} \cdot \left(2 \cdot {x}^{2} + 8 \cdot {x}^{2}\right)\right)\right) \]
      11. distribute-rgt-out99.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.4 \cdot 10^{-41}:\\ \;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{elif}\;x \leq 2.65 \cdot 10^{-39}:\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\varepsilon \cdot \varepsilon, \mathsf{fma}\left(4, {x}^{3}, x \cdot \left(\left(x \cdot x\right) \cdot 6\right)\right), \mathsf{fma}\left(\varepsilon, {x}^{4} \cdot 5, {\varepsilon}^{3} \cdot \left(10 \cdot \left(x \cdot x\right)\right)\right)\right)\\ \end{array} \]

Alternative 2: 97.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-39} \lor \neg \left(x \leq 2.65 \cdot 10^{-39}\right):\\ \;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (or (<= x -2.5e-39) (not (<= x 2.65e-39)))
   (+ (* (* eps (* eps 10.0)) (pow x 3.0)) (* (pow x 4.0) (* eps 5.0)))
   (- (pow (+ x eps) 5.0) (pow x 5.0))))
double code(double x, double eps) {
	double tmp;
	if ((x <= -2.5e-39) || !(x <= 2.65e-39)) {
		tmp = ((eps * (eps * 10.0)) * pow(x, 3.0)) + (pow(x, 4.0) * (eps * 5.0));
	} else {
		tmp = pow((x + eps), 5.0) - pow(x, 5.0);
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if ((x <= (-2.5d-39)) .or. (.not. (x <= 2.65d-39))) then
        tmp = ((eps * (eps * 10.0d0)) * (x ** 3.0d0)) + ((x ** 4.0d0) * (eps * 5.0d0))
    else
        tmp = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if ((x <= -2.5e-39) || !(x <= 2.65e-39)) {
		tmp = ((eps * (eps * 10.0)) * Math.pow(x, 3.0)) + (Math.pow(x, 4.0) * (eps * 5.0));
	} else {
		tmp = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if (x <= -2.5e-39) or not (x <= 2.65e-39):
		tmp = ((eps * (eps * 10.0)) * math.pow(x, 3.0)) + (math.pow(x, 4.0) * (eps * 5.0))
	else:
		tmp = math.pow((x + eps), 5.0) - math.pow(x, 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if ((x <= -2.5e-39) || !(x <= 2.65e-39))
		tmp = Float64(Float64(Float64(eps * Float64(eps * 10.0)) * (x ^ 3.0)) + Float64((x ^ 4.0) * Float64(eps * 5.0)));
	else
		tmp = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if ((x <= -2.5e-39) || ~((x <= 2.65e-39)))
		tmp = ((eps * (eps * 10.0)) * (x ^ 3.0)) + ((x ^ 4.0) * (eps * 5.0));
	else
		tmp = ((x + eps) ^ 5.0) - (x ^ 5.0);
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[Or[LessEqual[x, -2.5e-39], N[Not[LessEqual[x, 2.65e-39]], $MachinePrecision]], N[(N[(N[(eps * N[(eps * 10.0), $MachinePrecision]), $MachinePrecision] * N[Power[x, 3.0], $MachinePrecision]), $MachinePrecision] + N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{-39} \lor \neg \left(x \leq 2.65 \cdot 10^{-39}\right):\\
\;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\

\mathbf{else}:\\
\;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4999999999999999e-39 or 2.65000000000000002e-39 < x

    1. Initial program 26.8%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\left(\varepsilon \cdot \varepsilon\right) \cdot \color{blue}{10}, {x}^{3}, \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}\right) \]
      6. associate-*l*99.5%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\varepsilon \cdot \left(\varepsilon \cdot 10\right)}, {x}^{3}, \left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}\right) \]
      7. distribute-lft1-in99.5%

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right), {x}^{3}, \color{blue}{\left(\left(4 + 1\right) \cdot \varepsilon\right)} \cdot {x}^{4}\right) \]
      8. metadata-eval99.5%

        \[\leadsto \mathsf{fma}\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right), {x}^{3}, \left(\color{blue}{5} \cdot \varepsilon\right) \cdot {x}^{4}\right) \]
      9. *-commutative99.5%

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

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

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

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

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

    if -2.4999999999999999e-39 < x < 2.65000000000000002e-39

    1. Initial program 99.1%

      \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{-39} \lor \neg \left(x \leq 2.65 \cdot 10^{-39}\right):\\ \;\;\;\;\left(\varepsilon \cdot \left(\varepsilon \cdot 10\right)\right) \cdot {x}^{3} + {x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{else}:\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \end{array} \]

Alternative 3: 97.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-40}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\

\mathbf{elif}\;x \leq 2.65 \cdot 10^{-39}:\\
\;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -3.29999999999999993e-40

    1. Initial program 30.0%

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

      \[\leadsto \color{blue}{\left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}} \]
    3. Step-by-step derivation
      1. distribute-lft1-in97.8%

        \[\leadsto \color{blue}{\left(\left(4 + 1\right) \cdot \varepsilon\right)} \cdot {x}^{4} \]
      2. metadata-eval97.8%

        \[\leadsto \left(\color{blue}{5} \cdot \varepsilon\right) \cdot {x}^{4} \]
      3. *-commutative97.8%

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

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

    if -3.29999999999999993e-40 < x < 2.65000000000000002e-39

    1. Initial program 99.1%

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

    if 2.65000000000000002e-39 < x

    1. Initial program 22.1%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Taylor expanded in x around 0 94.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-40}:\\ \;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{elif}\;x \leq 2.65 \cdot 10^{-39}:\\ \;\;\;\;{\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\ \end{array} \]

Alternative 4: 97.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\ \;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -4.3e-41)
   (* 5.0 (* eps (pow x 4.0)))
   (if (<= x 8.2e-43) (pow eps 5.0) (* eps (* (pow x 4.0) 5.0)))))
double code(double x, double eps) {
	double tmp;
	if (x <= -4.3e-41) {
		tmp = 5.0 * (eps * pow(x, 4.0));
	} else if (x <= 8.2e-43) {
		tmp = pow(eps, 5.0);
	} else {
		tmp = eps * (pow(x, 4.0) * 5.0);
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if (x <= (-4.3d-41)) then
        tmp = 5.0d0 * (eps * (x ** 4.0d0))
    else if (x <= 8.2d-43) then
        tmp = eps ** 5.0d0
    else
        tmp = eps * ((x ** 4.0d0) * 5.0d0)
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -4.3e-41) {
		tmp = 5.0 * (eps * Math.pow(x, 4.0));
	} else if (x <= 8.2e-43) {
		tmp = Math.pow(eps, 5.0);
	} else {
		tmp = eps * (Math.pow(x, 4.0) * 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -4.3e-41:
		tmp = 5.0 * (eps * math.pow(x, 4.0))
	elif x <= 8.2e-43:
		tmp = math.pow(eps, 5.0)
	else:
		tmp = eps * (math.pow(x, 4.0) * 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -4.3e-41)
		tmp = Float64(5.0 * Float64(eps * (x ^ 4.0)));
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = Float64(eps * Float64((x ^ 4.0) * 5.0));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -4.3e-41)
		tmp = 5.0 * (eps * (x ^ 4.0));
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = eps * ((x ^ 4.0) * 5.0);
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -4.3e-41], N[(5.0 * N[(eps * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-43], N[Power[eps, 5.0], $MachinePrecision], N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\
\;\;\;\;{\varepsilon}^{5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.2999999999999999e-41

    1. Initial program 30.0%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Taylor expanded in x around 0 97.5%

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

    if -4.2999999999999999e-41 < x < 8.1999999999999996e-43

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{{\varepsilon}^{5}} \]

    if 8.1999999999999996e-43 < x

    1. Initial program 36.6%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Taylor expanded in x around 0 90.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\ \;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\ \end{array} \]

Alternative 5: 97.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\ \;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -4.3e-41)
   (* (pow x 4.0) (* eps 5.0))
   (if (<= x 8.2e-43) (pow eps 5.0) (* eps (* (pow x 4.0) 5.0)))))
double code(double x, double eps) {
	double tmp;
	if (x <= -4.3e-41) {
		tmp = pow(x, 4.0) * (eps * 5.0);
	} else if (x <= 8.2e-43) {
		tmp = pow(eps, 5.0);
	} else {
		tmp = eps * (pow(x, 4.0) * 5.0);
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if (x <= (-4.3d-41)) then
        tmp = (x ** 4.0d0) * (eps * 5.0d0)
    else if (x <= 8.2d-43) then
        tmp = eps ** 5.0d0
    else
        tmp = eps * ((x ** 4.0d0) * 5.0d0)
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -4.3e-41) {
		tmp = Math.pow(x, 4.0) * (eps * 5.0);
	} else if (x <= 8.2e-43) {
		tmp = Math.pow(eps, 5.0);
	} else {
		tmp = eps * (Math.pow(x, 4.0) * 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -4.3e-41:
		tmp = math.pow(x, 4.0) * (eps * 5.0)
	elif x <= 8.2e-43:
		tmp = math.pow(eps, 5.0)
	else:
		tmp = eps * (math.pow(x, 4.0) * 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -4.3e-41)
		tmp = Float64((x ^ 4.0) * Float64(eps * 5.0));
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = Float64(eps * Float64((x ^ 4.0) * 5.0));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -4.3e-41)
		tmp = (x ^ 4.0) * (eps * 5.0);
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = eps * ((x ^ 4.0) * 5.0);
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -4.3e-41], N[(N[Power[x, 4.0], $MachinePrecision] * N[(eps * 5.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-43], N[Power[eps, 5.0], $MachinePrecision], N[(eps * N[(N[Power[x, 4.0], $MachinePrecision] * 5.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\
\;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\
\;\;\;\;{\varepsilon}^{5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -4.2999999999999999e-41

    1. Initial program 30.0%

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

      \[\leadsto \color{blue}{\left(4 \cdot \varepsilon + \varepsilon\right) \cdot {x}^{4}} \]
    3. Step-by-step derivation
      1. distribute-lft1-in97.8%

        \[\leadsto \color{blue}{\left(\left(4 + 1\right) \cdot \varepsilon\right)} \cdot {x}^{4} \]
      2. metadata-eval97.8%

        \[\leadsto \left(\color{blue}{5} \cdot \varepsilon\right) \cdot {x}^{4} \]
      3. *-commutative97.8%

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

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

    if -4.2999999999999999e-41 < x < 8.1999999999999996e-43

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{{\varepsilon}^{5}} \]

    if 8.1999999999999996e-43 < x

    1. Initial program 36.6%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Taylor expanded in x around 0 90.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41}:\\ \;\;\;\;{x}^{4} \cdot \left(\varepsilon \cdot 5\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left({x}^{4} \cdot 5\right)\\ \end{array} \]

Alternative 6: 97.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-41}:\\ \;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -7.8e-41)
   (* 5.0 (* eps (pow x 4.0)))
   (if (<= x 8.2e-43) (pow eps 5.0) (* eps (* (* x x) (* 5.0 (* x x)))))))
double code(double x, double eps) {
	double tmp;
	if (x <= -7.8e-41) {
		tmp = 5.0 * (eps * pow(x, 4.0));
	} else if (x <= 8.2e-43) {
		tmp = pow(eps, 5.0);
	} else {
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if (x <= (-7.8d-41)) then
        tmp = 5.0d0 * (eps * (x ** 4.0d0))
    else if (x <= 8.2d-43) then
        tmp = eps ** 5.0d0
    else
        tmp = eps * ((x * x) * (5.0d0 * (x * x)))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -7.8e-41) {
		tmp = 5.0 * (eps * Math.pow(x, 4.0));
	} else if (x <= 8.2e-43) {
		tmp = Math.pow(eps, 5.0);
	} else {
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -7.8e-41:
		tmp = 5.0 * (eps * math.pow(x, 4.0))
	elif x <= 8.2e-43:
		tmp = math.pow(eps, 5.0)
	else:
		tmp = eps * ((x * x) * (5.0 * (x * x)))
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -7.8e-41)
		tmp = Float64(5.0 * Float64(eps * (x ^ 4.0)));
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = Float64(eps * Float64(Float64(x * x) * Float64(5.0 * Float64(x * x))));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -7.8e-41)
		tmp = 5.0 * (eps * (x ^ 4.0));
	elseif (x <= 8.2e-43)
		tmp = eps ^ 5.0;
	else
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -7.8e-41], N[(5.0 * N[(eps * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.2e-43], N[Power[eps, 5.0], $MachinePrecision], N[(eps * N[(N[(x * x), $MachinePrecision] * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.8 \cdot 10^{-41}:\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\

\mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\
\;\;\;\;{\varepsilon}^{5}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -7.79999999999999982e-41

    1. Initial program 30.0%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Taylor expanded in x around 0 97.5%

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

    if -7.79999999999999982e-41 < x < 8.1999999999999996e-43

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{{\varepsilon}^{5}} \]

    if 8.1999999999999996e-43 < x

    1. Initial program 36.6%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Step-by-step derivation
      1. +-commutative90.0%

        \[\leadsto \varepsilon \cdot \color{blue}{\left({x}^{4} + 4 \cdot {x}^{4}\right)} \]
      2. metadata-eval90.0%

        \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{\left(2 + 2\right)}} + 4 \cdot {x}^{4}\right) \]
      3. pow-prod-up89.9%

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

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

        \[\leadsto \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} + 4 \cdot {x}^{4}\right) \]
      6. fma-def90.0%

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

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

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

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{\left(x \cdot x\right)}^{2}} + 4 \cdot {x}^{4}\right) \]
      3. pow-prod-down89.9%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{2} \cdot {x}^{2}} + 4 \cdot {x}^{4}\right) \]
      4. pow-sqr90.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{\left(2 \cdot 2\right)}} + 4 \cdot {x}^{4}\right) \]
      5. metadata-eval90.0%

        \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{4}} + 4 \cdot {x}^{4}\right) \]
      6. distribute-rgt1-in90.0%

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(4 + 1\right) \cdot {x}^{4}\right)} \]
      7. metadata-eval90.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{5} \cdot {x}^{4}\right) \]
      8. metadata-eval90.0%

        \[\leadsto \varepsilon \cdot \left(5 \cdot {x}^{\color{blue}{\left(2 \cdot 2\right)}}\right) \]
      9. pow-sqr89.8%

        \[\leadsto \varepsilon \cdot \left(5 \cdot \color{blue}{\left({x}^{2} \cdot {x}^{2}\right)}\right) \]
      10. pow289.8%

        \[\leadsto \varepsilon \cdot \left(5 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot {x}^{2}\right)\right) \]
      11. pow289.8%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7.8 \cdot 10^{-41}:\\ \;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 8.2 \cdot 10^{-43}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\\ \end{array} \]

Alternative 7: 97.4% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41} \lor \neg \left(x \leq 1.12 \cdot 10^{-42}\right):\\ \;\;\;\;\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\varepsilon}^{5}\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (or (<= x -4.3e-41) (not (<= x 1.12e-42)))
   (* eps (* (* x x) (* 5.0 (* x x))))
   (pow eps 5.0)))
double code(double x, double eps) {
	double tmp;
	if ((x <= -4.3e-41) || !(x <= 1.12e-42)) {
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	} else {
		tmp = pow(eps, 5.0);
	}
	return tmp;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: tmp
    if ((x <= (-4.3d-41)) .or. (.not. (x <= 1.12d-42))) then
        tmp = eps * ((x * x) * (5.0d0 * (x * x)))
    else
        tmp = eps ** 5.0d0
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if ((x <= -4.3e-41) || !(x <= 1.12e-42)) {
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	} else {
		tmp = Math.pow(eps, 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if (x <= -4.3e-41) or not (x <= 1.12e-42):
		tmp = eps * ((x * x) * (5.0 * (x * x)))
	else:
		tmp = math.pow(eps, 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if ((x <= -4.3e-41) || !(x <= 1.12e-42))
		tmp = Float64(eps * Float64(Float64(x * x) * Float64(5.0 * Float64(x * x))));
	else
		tmp = eps ^ 5.0;
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if ((x <= -4.3e-41) || ~((x <= 1.12e-42)))
		tmp = eps * ((x * x) * (5.0 * (x * x)));
	else
		tmp = eps ^ 5.0;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[Or[LessEqual[x, -4.3e-41], N[Not[LessEqual[x, 1.12e-42]], $MachinePrecision]], N[(eps * N[(N[(x * x), $MachinePrecision] * N[(5.0 * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[eps, 5.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-41} \lor \neg \left(x \leq 1.12 \cdot 10^{-42}\right):\\
\;\;\;\;\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;{\varepsilon}^{5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2999999999999999e-41 or 1.1199999999999999e-42 < x

    1. Initial program 33.0%

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

      \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
    3. Step-by-step derivation
      1. +-commutative94.1%

        \[\leadsto \varepsilon \cdot \color{blue}{\left({x}^{4} + 4 \cdot {x}^{4}\right)} \]
      2. metadata-eval94.1%

        \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{\left(2 + 2\right)}} + 4 \cdot {x}^{4}\right) \]
      3. pow-prod-up94.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{2} \cdot {x}^{2}} + 4 \cdot {x}^{4}\right) \]
      4. pow294.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot {x}^{2} + 4 \cdot {x}^{4}\right) \]
      5. pow294.0%

        \[\leadsto \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} + 4 \cdot {x}^{4}\right) \]
      6. fma-def94.1%

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

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + 4 \cdot {x}^{4}\right)} \]
      2. pow294.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{\left(x \cdot x\right)}^{2}} + 4 \cdot {x}^{4}\right) \]
      3. pow-prod-down94.0%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{2} \cdot {x}^{2}} + 4 \cdot {x}^{4}\right) \]
      4. pow-sqr94.1%

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

        \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{4}} + 4 \cdot {x}^{4}\right) \]
      6. distribute-rgt1-in94.1%

        \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(4 + 1\right) \cdot {x}^{4}\right)} \]
      7. metadata-eval94.1%

        \[\leadsto \varepsilon \cdot \left(\color{blue}{5} \cdot {x}^{4}\right) \]
      8. metadata-eval94.1%

        \[\leadsto \varepsilon \cdot \left(5 \cdot {x}^{\color{blue}{\left(2 \cdot 2\right)}}\right) \]
      9. pow-sqr93.9%

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

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

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

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

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

    if -4.2999999999999999e-41 < x < 1.1199999999999999e-42

    1. Initial program 99.2%

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

      \[\leadsto \color{blue}{{\varepsilon}^{5}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{-41} \lor \neg \left(x \leq 1.12 \cdot 10^{-42}\right):\\ \;\;\;\;\varepsilon \cdot \left(\left(x \cdot x\right) \cdot \left(5 \cdot \left(x \cdot x\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\varepsilon}^{5}\\ \end{array} \]

Alternative 8: 82.0% accurate, 18.8× 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 90.6%

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

    \[\leadsto \color{blue}{\varepsilon \cdot \left(4 \cdot {x}^{4} + {x}^{4}\right)} \]
  3. Step-by-step derivation
    1. +-commutative84.3%

      \[\leadsto \varepsilon \cdot \color{blue}{\left({x}^{4} + 4 \cdot {x}^{4}\right)} \]
    2. metadata-eval84.3%

      \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{\left(2 + 2\right)}} + 4 \cdot {x}^{4}\right) \]
    3. pow-prod-up84.3%

      \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{2} \cdot {x}^{2}} + 4 \cdot {x}^{4}\right) \]
    4. pow284.3%

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

      \[\leadsto \varepsilon \cdot \left(\left(x \cdot x\right) \cdot \color{blue}{\left(x \cdot x\right)} + 4 \cdot {x}^{4}\right) \]
    6. fma-def84.3%

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

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

      \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) + 4 \cdot {x}^{4}\right)} \]
    2. pow284.3%

      \[\leadsto \varepsilon \cdot \left(\color{blue}{{\left(x \cdot x\right)}^{2}} + 4 \cdot {x}^{4}\right) \]
    3. pow-prod-down84.3%

      \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{2} \cdot {x}^{2}} + 4 \cdot {x}^{4}\right) \]
    4. pow-sqr84.3%

      \[\leadsto \varepsilon \cdot \left(\color{blue}{{x}^{\left(2 \cdot 2\right)}} + 4 \cdot {x}^{4}\right) \]
    5. metadata-eval84.3%

      \[\leadsto \varepsilon \cdot \left({x}^{\color{blue}{4}} + 4 \cdot {x}^{4}\right) \]
    6. distribute-rgt1-in84.3%

      \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(4 + 1\right) \cdot {x}^{4}\right)} \]
    7. metadata-eval84.3%

      \[\leadsto \varepsilon \cdot \left(\color{blue}{5} \cdot {x}^{4}\right) \]
    8. metadata-eval84.3%

      \[\leadsto \varepsilon \cdot \left(5 \cdot {x}^{\color{blue}{\left(2 \cdot 2\right)}}\right) \]
    9. pow-sqr84.3%

      \[\leadsto \varepsilon \cdot \left(5 \cdot \color{blue}{\left({x}^{2} \cdot {x}^{2}\right)}\right) \]
    10. pow284.3%

      \[\leadsto \varepsilon \cdot \left(5 \cdot \left(\color{blue}{\left(x \cdot x\right)} \cdot {x}^{2}\right)\right) \]
    11. pow284.3%

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

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

    \[\leadsto \varepsilon \cdot \color{blue}{\left(\left(5 \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot x\right)\right)} \]
  7. Final simplification84.3%

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

Alternative 9: 70.5% accurate, 207.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
	return 0.0;
}
real(8) function code(x, eps)
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = 0.0d0
end function
public static double code(double x, double eps) {
	return 0.0;
}
def code(x, eps):
	return 0.0
function code(x, eps)
	return 0.0
end
function tmp = code(x, eps)
	tmp = 0.0;
end
code[x_, eps_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 90.6%

    \[{\left(x + \varepsilon\right)}^{5} - {x}^{5} \]
  2. Step-by-step derivation
    1. sqr-pow44.1%

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

      \[\leadsto {\left(x + \varepsilon\right)}^{\color{blue}{2.5}} \cdot {\left(x + \varepsilon\right)}^{\left(\frac{5}{2}\right)} - {x}^{5} \]
    3. metadata-eval44.1%

      \[\leadsto {\left(x + \varepsilon\right)}^{2.5} \cdot {\left(x + \varepsilon\right)}^{\color{blue}{2.5}} - {x}^{5} \]
  3. Applied egg-rr44.1%

    \[\leadsto \color{blue}{{\left(x + \varepsilon\right)}^{2.5} \cdot {\left(x + \varepsilon\right)}^{2.5}} - {x}^{5} \]
  4. Step-by-step derivation
    1. pow244.1%

      \[\leadsto \color{blue}{{\left({\left(x + \varepsilon\right)}^{2.5}\right)}^{2}} - {x}^{5} \]
  5. Applied egg-rr44.1%

    \[\leadsto \color{blue}{{\left({\left(x + \varepsilon\right)}^{2.5}\right)}^{2}} - {x}^{5} \]
  6. Taylor expanded in x around inf 74.5%

    \[\leadsto \color{blue}{{x}^{5} + -1 \cdot {x}^{5}} \]
  7. Step-by-step derivation
    1. distribute-rgt1-in74.5%

      \[\leadsto \color{blue}{\left(-1 + 1\right) \cdot {x}^{5}} \]
    2. metadata-eval74.5%

      \[\leadsto \color{blue}{0} \cdot {x}^{5} \]
    3. mul0-lft74.5%

      \[\leadsto \color{blue}{0} \]
  8. Simplified74.5%

    \[\leadsto \color{blue}{0} \]
  9. Final simplification74.5%

    \[\leadsto 0 \]

Reproduce

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