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

Percentage Accurate: 88.9% → 97.4%
Time: 8.5s
Alternatives: 10
Speedup: 1.8×

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 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 88.9% 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.4% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;x \leq 5 \cdot 10^{-80}:\\
\;\;\;\;\mathsf{fma}\left(x, 5 \cdot {\varepsilon}^{4}, {\varepsilon}^{5}\right)\\

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


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

    1. Initial program 41.7%

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

      \[\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. +-commutative96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2000000000000001e-55 < x < 5e-80

    1. Initial program 100.0%

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

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

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

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

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

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

    if 5e-80 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

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

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

Alternative 2: 97.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{-55}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4} + \varepsilon \cdot \left({x}^{3} \cdot 10\right)\right)\\ \mathbf{elif}\;x \leq 2 \cdot 10^{-81}:\\ \;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5 + \varepsilon \cdot 10\right)\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -2.8e-55)
   (* eps (+ (* 5.0 (pow x 4.0)) (* eps (* (pow x 3.0) 10.0))))
   (if (<= x 2e-81)
     (* (pow eps 5.0) (+ 1.0 (* 5.0 (/ x eps))))
     (* (pow x 3.0) (* eps (+ (* x 5.0) (* eps 10.0)))))))
double code(double x, double eps) {
	double tmp;
	if (x <= -2.8e-55) {
		tmp = eps * ((5.0 * pow(x, 4.0)) + (eps * (pow(x, 3.0) * 10.0)));
	} else if (x <= 2e-81) {
		tmp = pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)));
	} else {
		tmp = pow(x, 3.0) * (eps * ((x * 5.0) + (eps * 10.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.8d-55)) then
        tmp = eps * ((5.0d0 * (x ** 4.0d0)) + (eps * ((x ** 3.0d0) * 10.0d0)))
    else if (x <= 2d-81) then
        tmp = (eps ** 5.0d0) * (1.0d0 + (5.0d0 * (x / eps)))
    else
        tmp = (x ** 3.0d0) * (eps * ((x * 5.0d0) + (eps * 10.0d0)))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -2.8e-55) {
		tmp = eps * ((5.0 * Math.pow(x, 4.0)) + (eps * (Math.pow(x, 3.0) * 10.0)));
	} else if (x <= 2e-81) {
		tmp = Math.pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)));
	} else {
		tmp = Math.pow(x, 3.0) * (eps * ((x * 5.0) + (eps * 10.0)));
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -2.8e-55:
		tmp = eps * ((5.0 * math.pow(x, 4.0)) + (eps * (math.pow(x, 3.0) * 10.0)))
	elif x <= 2e-81:
		tmp = math.pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)))
	else:
		tmp = math.pow(x, 3.0) * (eps * ((x * 5.0) + (eps * 10.0)))
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -2.8e-55)
		tmp = Float64(eps * Float64(Float64(5.0 * (x ^ 4.0)) + Float64(eps * Float64((x ^ 3.0) * 10.0))));
	elseif (x <= 2e-81)
		tmp = Float64((eps ^ 5.0) * Float64(1.0 + Float64(5.0 * Float64(x / eps))));
	else
		tmp = Float64((x ^ 3.0) * Float64(eps * Float64(Float64(x * 5.0) + Float64(eps * 10.0))));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -2.8e-55)
		tmp = eps * ((5.0 * (x ^ 4.0)) + (eps * ((x ^ 3.0) * 10.0)));
	elseif (x <= 2e-81)
		tmp = (eps ^ 5.0) * (1.0 + (5.0 * (x / eps)));
	else
		tmp = (x ^ 3.0) * (eps * ((x * 5.0) + (eps * 10.0)));
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -2.8e-55], N[(eps * N[(N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision] + N[(eps * N[(N[Power[x, 3.0], $MachinePrecision] * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2e-81], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(1.0 + N[(5.0 * N[(x / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, 3.0], $MachinePrecision] * N[(eps * N[(N[(x * 5.0), $MachinePrecision] + N[(eps * 10.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 2 \cdot 10^{-81}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\

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


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

    1. Initial program 41.7%

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

      \[\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. +-commutative96.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.79999999999999984e-55 < x < 1.9999999999999999e-81

    1. Initial program 100.0%

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

      \[\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. distribute-lft1-in100.0%

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

        \[\leadsto {\varepsilon}^{5} \cdot \left(1 + \color{blue}{5} \cdot \frac{x}{\varepsilon}\right) \]
    5. Simplified100.0%

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

    if 1.9999999999999999e-81 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

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

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

Alternative 3: 97.4% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.1 \cdot 10^{-54} \lor \neg \left(x \leq 1.4 \cdot 10^{-79}\right):\\
\;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5 + \varepsilon \cdot 10\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.10000000000000004e-54 or 1.40000000000000006e-79 < x

    1. Initial program 48.3%

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

      \[\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. +-commutative98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.10000000000000004e-54 < x < 1.40000000000000006e-79

    1. Initial program 100.0%

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

      \[\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. distribute-lft1-in100.0%

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

        \[\leadsto {\varepsilon}^{5} \cdot \left(1 + \color{blue}{5} \cdot \frac{x}{\varepsilon}\right) \]
    5. Simplified100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.1 \cdot 10^{-54} \lor \neg \left(x \leq 1.4 \cdot 10^{-79}\right):\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5 + \varepsilon \cdot 10\right)\right)\\ \mathbf{else}:\\ \;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 97.4% accurate, 1.7× speedup?

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

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

\mathbf{elif}\;x \leq 2 \cdot 10^{-80}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\

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


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

    1. Initial program 41.7%

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

      \[\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. +-commutative96.1%

        \[\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) \]
      2. associate-+r+96.1%

        \[\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)} \]
      3. mul-1-neg96.1%

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

        \[\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)} \]
      5. distribute-rgt1-in96.1%

        \[\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) \]
      6. metadata-eval96.1%

        \[\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) \]
      7. *-commutative96.1%

        \[\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) \]
    5. Simplified96.1%

      \[\leadsto \color{blue}{{x}^{4} \cdot \left(\varepsilon \cdot 5 - \frac{{\varepsilon}^{2} \cdot -10}{x}\right)} \]
    6. Taylor expanded in eps around 0 96.1%

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

        \[\leadsto {x}^{4} \cdot \left(\varepsilon \cdot \left(5 + \color{blue}{\frac{\varepsilon}{x} \cdot 10}\right)\right) \]
    8. Simplified96.1%

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

    if -5.0000000000000002e-55 < x < 1.99999999999999992e-80

    1. Initial program 100.0%

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

      \[\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. distribute-lft1-in100.0%

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

        \[\leadsto {\varepsilon}^{5} \cdot \left(1 + \color{blue}{5} \cdot \frac{x}{\varepsilon}\right) \]
    5. Simplified100.0%

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

    if 1.99999999999999992e-80 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

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

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

Alternative 5: 97.3% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-56}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\ \;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -6.5e-56)
   (* eps (* 5.0 (pow x 4.0)))
   (if (<= x 1.4e-79)
     (* (pow eps 5.0) (+ 1.0 (* 5.0 (/ x eps))))
     (* (pow x 3.0) (* eps (* x 5.0))))))
double code(double x, double eps) {
	double tmp;
	if (x <= -6.5e-56) {
		tmp = eps * (5.0 * pow(x, 4.0));
	} else if (x <= 1.4e-79) {
		tmp = pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)));
	} else {
		tmp = pow(x, 3.0) * (eps * (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 <= (-6.5d-56)) then
        tmp = eps * (5.0d0 * (x ** 4.0d0))
    else if (x <= 1.4d-79) then
        tmp = (eps ** 5.0d0) * (1.0d0 + (5.0d0 * (x / eps)))
    else
        tmp = (x ** 3.0d0) * (eps * (x * 5.0d0))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -6.5e-56) {
		tmp = eps * (5.0 * Math.pow(x, 4.0));
	} else if (x <= 1.4e-79) {
		tmp = Math.pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)));
	} else {
		tmp = Math.pow(x, 3.0) * (eps * (x * 5.0));
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -6.5e-56:
		tmp = eps * (5.0 * math.pow(x, 4.0))
	elif x <= 1.4e-79:
		tmp = math.pow(eps, 5.0) * (1.0 + (5.0 * (x / eps)))
	else:
		tmp = math.pow(x, 3.0) * (eps * (x * 5.0))
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -6.5e-56)
		tmp = Float64(eps * Float64(5.0 * (x ^ 4.0)));
	elseif (x <= 1.4e-79)
		tmp = Float64((eps ^ 5.0) * Float64(1.0 + Float64(5.0 * Float64(x / eps))));
	else
		tmp = Float64((x ^ 3.0) * Float64(eps * Float64(x * 5.0)));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -6.5e-56)
		tmp = eps * (5.0 * (x ^ 4.0));
	elseif (x <= 1.4e-79)
		tmp = (eps ^ 5.0) * (1.0 + (5.0 * (x / eps)));
	else
		tmp = (x ^ 3.0) * (eps * (x * 5.0));
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -6.5e-56], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e-79], N[(N[Power[eps, 5.0], $MachinePrecision] * N[(1.0 + N[(5.0 * N[(x / eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Power[x, 3.0], $MachinePrecision] * N[(eps * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\
\;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\

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


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

    1. Initial program 41.7%

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

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

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

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

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

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

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

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

    if -6.4999999999999997e-56 < x < 1.40000000000000006e-79

    1. Initial program 100.0%

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

      \[\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. distribute-lft1-in100.0%

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

        \[\leadsto {\varepsilon}^{5} \cdot \left(1 + \color{blue}{5} \cdot \frac{x}{\varepsilon}\right) \]
    5. Simplified100.0%

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

    if 1.40000000000000006e-79 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

      \[\leadsto \color{blue}{{x}^{3} \cdot \left(\varepsilon \cdot \left(5 \cdot x + \varepsilon \cdot 10\right)\right)} \]
    9. Taylor expanded in eps around 0 99.1%

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

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

        \[\leadsto {x}^{3} \cdot {\color{blue}{\left(\left(\varepsilon \cdot x\right) \cdot 5\right)}}^{1} \]
      3. associate-*l*99.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.5 \cdot 10^{-56}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\ \;\;\;\;{\varepsilon}^{5} \cdot \left(1 + 5 \cdot \frac{x}{\varepsilon}\right)\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{-54}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (<= x -8.6e-54)
   (* eps (* 5.0 (pow x 4.0)))
   (if (<= x 1.4e-79) (pow eps 5.0) (* (pow x 3.0) (* eps (* x 5.0))))))
double code(double x, double eps) {
	double tmp;
	if (x <= -8.6e-54) {
		tmp = eps * (5.0 * pow(x, 4.0));
	} else if (x <= 1.4e-79) {
		tmp = pow(eps, 5.0);
	} else {
		tmp = pow(x, 3.0) * (eps * (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 <= (-8.6d-54)) then
        tmp = eps * (5.0d0 * (x ** 4.0d0))
    else if (x <= 1.4d-79) then
        tmp = eps ** 5.0d0
    else
        tmp = (x ** 3.0d0) * (eps * (x * 5.0d0))
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if (x <= -8.6e-54) {
		tmp = eps * (5.0 * Math.pow(x, 4.0));
	} else if (x <= 1.4e-79) {
		tmp = Math.pow(eps, 5.0);
	} else {
		tmp = Math.pow(x, 3.0) * (eps * (x * 5.0));
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if x <= -8.6e-54:
		tmp = eps * (5.0 * math.pow(x, 4.0))
	elif x <= 1.4e-79:
		tmp = math.pow(eps, 5.0)
	else:
		tmp = math.pow(x, 3.0) * (eps * (x * 5.0))
	return tmp
function code(x, eps)
	tmp = 0.0
	if (x <= -8.6e-54)
		tmp = Float64(eps * Float64(5.0 * (x ^ 4.0)));
	elseif (x <= 1.4e-79)
		tmp = eps ^ 5.0;
	else
		tmp = Float64((x ^ 3.0) * Float64(eps * Float64(x * 5.0)));
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if (x <= -8.6e-54)
		tmp = eps * (5.0 * (x ^ 4.0));
	elseif (x <= 1.4e-79)
		tmp = eps ^ 5.0;
	else
		tmp = (x ^ 3.0) * (eps * (x * 5.0));
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[LessEqual[x, -8.6e-54], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.4e-79], N[Power[eps, 5.0], $MachinePrecision], N[(N[Power[x, 3.0], $MachinePrecision] * N[(eps * N[(x * 5.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\
\;\;\;\;{\varepsilon}^{5}\\

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


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

    1. Initial program 41.7%

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

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

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

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

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

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

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

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

    if -8.5999999999999999e-54 < x < 1.40000000000000006e-79

    1. Initial program 100.0%

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

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

    if 1.40000000000000006e-79 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

      \[\leadsto \color{blue}{{x}^{3} \cdot \left(\varepsilon \cdot \left(5 \cdot x + \varepsilon \cdot 10\right)\right)} \]
    9. Taylor expanded in eps around 0 99.1%

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

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

        \[\leadsto {x}^{3} \cdot {\color{blue}{\left(\left(\varepsilon \cdot x\right) \cdot 5\right)}}^{1} \]
      3. associate-*l*99.2%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.6 \cdot 10^{-54}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(\varepsilon \cdot \left(x \cdot 5\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 97.2% accurate, 1.8× speedup?

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

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

\mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\
\;\;\;\;{\varepsilon}^{5}\\

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


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

    1. Initial program 41.7%

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

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

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

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

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

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

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

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

    if -4.80000000000000001e-56 < x < 1.40000000000000006e-79

    1. Initial program 100.0%

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

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

    if 1.40000000000000006e-79 < x

    1. Initial program 53.3%

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

      \[\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. +-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto {x}^{3} \cdot \left(\left(5 \cdot x\right) \cdot \varepsilon + \color{blue}{\left(10 \cdot \varepsilon\right) \cdot \varepsilon}\right) \]
      5. distribute-rgt-out99.9%

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

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

      \[\leadsto \color{blue}{{x}^{3} \cdot \left(\varepsilon \cdot \left(5 \cdot x + \varepsilon \cdot 10\right)\right)} \]
    9. Taylor expanded in eps around 0 99.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.8 \cdot 10^{-56}:\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{elif}\;x \leq 1.4 \cdot 10^{-79}:\\ \;\;\;\;{\varepsilon}^{5}\\ \mathbf{else}:\\ \;\;\;\;{x}^{3} \cdot \left(5 \cdot \left(x \cdot \varepsilon\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 97.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.2 \cdot 10^{-54} \lor \neg \left(x \leq 2 \cdot 10^{-80}\right):\\ \;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;{\varepsilon}^{5}\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (or (<= x -3.2e-54) (not (<= x 2e-80)))
   (* eps (* 5.0 (pow x 4.0)))
   (pow eps 5.0)))
double code(double x, double eps) {
	double tmp;
	if ((x <= -3.2e-54) || !(x <= 2e-80)) {
		tmp = eps * (5.0 * pow(x, 4.0));
	} 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 <= (-3.2d-54)) .or. (.not. (x <= 2d-80))) then
        tmp = eps * (5.0d0 * (x ** 4.0d0))
    else
        tmp = eps ** 5.0d0
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if ((x <= -3.2e-54) || !(x <= 2e-80)) {
		tmp = eps * (5.0 * Math.pow(x, 4.0));
	} else {
		tmp = Math.pow(eps, 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if (x <= -3.2e-54) or not (x <= 2e-80):
		tmp = eps * (5.0 * math.pow(x, 4.0))
	else:
		tmp = math.pow(eps, 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if ((x <= -3.2e-54) || !(x <= 2e-80))
		tmp = Float64(eps * Float64(5.0 * (x ^ 4.0)));
	else
		tmp = eps ^ 5.0;
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if ((x <= -3.2e-54) || ~((x <= 2e-80)))
		tmp = eps * (5.0 * (x ^ 4.0));
	else
		tmp = eps ^ 5.0;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[Or[LessEqual[x, -3.2e-54], N[Not[LessEqual[x, 2e-80]], $MachinePrecision]], N[(eps * N[(5.0 * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[eps, 5.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-54} \lor \neg \left(x \leq 2 \cdot 10^{-80}\right):\\
\;\;\;\;\varepsilon \cdot \left(5 \cdot {x}^{4}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.19999999999999998e-54 or 1.99999999999999992e-80 < x

    1. Initial program 48.3%

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

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

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

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

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

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

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

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

    if -3.19999999999999998e-54 < x < 1.99999999999999992e-80

    1. Initial program 100.0%

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

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

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

Alternative 9: 97.2% accurate, 1.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{-54} \lor \neg \left(x \leq 1.4 \cdot 10^{-79}\right):\\ \;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\ \mathbf{else}:\\ \;\;\;\;{\varepsilon}^{5}\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (if (or (<= x -1.7e-54) (not (<= x 1.4e-79)))
   (* 5.0 (* eps (pow x 4.0)))
   (pow eps 5.0)))
double code(double x, double eps) {
	double tmp;
	if ((x <= -1.7e-54) || !(x <= 1.4e-79)) {
		tmp = 5.0 * (eps * pow(x, 4.0));
	} 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 <= (-1.7d-54)) .or. (.not. (x <= 1.4d-79))) then
        tmp = 5.0d0 * (eps * (x ** 4.0d0))
    else
        tmp = eps ** 5.0d0
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double tmp;
	if ((x <= -1.7e-54) || !(x <= 1.4e-79)) {
		tmp = 5.0 * (eps * Math.pow(x, 4.0));
	} else {
		tmp = Math.pow(eps, 5.0);
	}
	return tmp;
}
def code(x, eps):
	tmp = 0
	if (x <= -1.7e-54) or not (x <= 1.4e-79):
		tmp = 5.0 * (eps * math.pow(x, 4.0))
	else:
		tmp = math.pow(eps, 5.0)
	return tmp
function code(x, eps)
	tmp = 0.0
	if ((x <= -1.7e-54) || !(x <= 1.4e-79))
		tmp = Float64(5.0 * Float64(eps * (x ^ 4.0)));
	else
		tmp = eps ^ 5.0;
	end
	return tmp
end
function tmp_2 = code(x, eps)
	tmp = 0.0;
	if ((x <= -1.7e-54) || ~((x <= 1.4e-79)))
		tmp = 5.0 * (eps * (x ^ 4.0));
	else
		tmp = eps ^ 5.0;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := If[Or[LessEqual[x, -1.7e-54], N[Not[LessEqual[x, 1.4e-79]], $MachinePrecision]], N[(5.0 * N[(eps * N[Power[x, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Power[eps, 5.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{-54} \lor \neg \left(x \leq 1.4 \cdot 10^{-79}\right):\\
\;\;\;\;5 \cdot \left(\varepsilon \cdot {x}^{4}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.69999999999999994e-54 or 1.40000000000000006e-79 < x

    1. Initial program 48.3%

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

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

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

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

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

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

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

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

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

    if -1.69999999999999994e-54 < x < 1.40000000000000006e-79

    1. Initial program 100.0%

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

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

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

Alternative 10: 87.9% accurate, 2.0× speedup?

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

\\
{\varepsilon}^{5}
\end{array}
Derivation
  1. Initial program 87.7%

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

    \[\leadsto \color{blue}{{\varepsilon}^{5}} \]
  4. Add Preprocessing

Reproduce

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