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

Percentage Accurate: 88.9% → 97.7%
Time: 11.5s
Alternatives: 17
Speedup: 4.7×

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 17 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.7% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(x + \varepsilon\right)}^{5} - \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) \]
      9. lower-*.f6497.6

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

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

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

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 96.9%

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

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

Alternative 2: 97.7% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

        \[\leadsto {\left(x + \varepsilon\right)}^{5} - \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right) \cdot \left(x \cdot x\right) \]
      9. lower-*.f6497.3

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

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

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

    1. Initial program 87.2%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \varepsilon \cdot \color{blue}{\left(5 \cdot {x}^{4}\right)} \]
      10. lower-pow.f6497.8

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

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

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

Reproduce

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