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

Percentage Accurate: 88.3% → 99.3%
Time: 3.8s
Alternatives: 11
Speedup: 0.4×

Specification

?
\[\left(-1000000000 \leq x \land x \leq 1000000000\right) \land \left(-1 \leq \varepsilon \land \varepsilon \leq 1\right)\]
\[\begin{array}{l} \\ {\left(x + \varepsilon\right)}^{5} - {x}^{5} \end{array} \]
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
	return pow((x + eps), 5.0) - pow(x, 5.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}

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 11 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.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {\left(x + \varepsilon\right)}^{5} - {x}^{5} \end{array} \]
(FPCore (x eps) :precision binary64 (- (pow (+ x eps) 5.0) (pow x 5.0)))
double code(double x, double eps) {
	return pow((x + eps), 5.0) - pow(x, 5.0);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

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

\\
{\left(x + \varepsilon\right)}^{5} - {x}^{5}
\end{array}

Alternative 1: 99.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(x + \varepsilon\right)}^{5} - {x}^{5}\\ \mathbf{if}\;t\_0 \leq -2 \cdot 10^{-308}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x eps)
 :precision binary64
 (let* ((t_0 (- (pow (+ x eps) 5.0) (pow x 5.0))))
   (if (<= t_0 -2e-308)
     t_0
     (if (<= t_0 0.0) (* (* 5.0 (* (pow x 3.0) x)) eps) t_0))))
double code(double x, double eps) {
	double t_0 = pow((x + eps), 5.0) - pow(x, 5.0);
	double tmp;
	if (t_0 <= -2e-308) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * (pow(x, 3.0) * x)) * eps;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((x + eps) ** 5.0d0) - (x ** 5.0d0)
    if (t_0 <= (-2d-308)) then
        tmp = t_0
    else if (t_0 <= 0.0d0) then
        tmp = (5.0d0 * ((x ** 3.0d0) * x)) * eps
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double eps) {
	double t_0 = Math.pow((x + eps), 5.0) - Math.pow(x, 5.0);
	double tmp;
	if (t_0 <= -2e-308) {
		tmp = t_0;
	} else if (t_0 <= 0.0) {
		tmp = (5.0 * (Math.pow(x, 3.0) * x)) * eps;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, eps):
	t_0 = math.pow((x + eps), 5.0) - math.pow(x, 5.0)
	tmp = 0
	if t_0 <= -2e-308:
		tmp = t_0
	elif t_0 <= 0.0:
		tmp = (5.0 * (math.pow(x, 3.0) * x)) * eps
	else:
		tmp = t_0
	return tmp
function code(x, eps)
	t_0 = Float64((Float64(x + eps) ^ 5.0) - (x ^ 5.0))
	tmp = 0.0
	if (t_0 <= -2e-308)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = Float64(Float64(5.0 * Float64((x ^ 3.0) * x)) * eps);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, eps)
	t_0 = ((x + eps) ^ 5.0) - (x ^ 5.0);
	tmp = 0.0;
	if (t_0 <= -2e-308)
		tmp = t_0;
	elseif (t_0 <= 0.0)
		tmp = (5.0 * ((x ^ 3.0) * x)) * eps;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, eps_] := Block[{t$95$0 = N[(N[Power[N[(x + eps), $MachinePrecision], 5.0], $MachinePrecision] - N[Power[x, 5.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -2e-308], t$95$0, If[LessEqual[t$95$0, 0.0], N[(N[(5.0 * N[(N[Power[x, 3.0], $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 97.9%

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
      9. lift-pow.f6499.7

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
    8. Applied rewrites99.7%

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

Alternative 2: 98.6% accurate, 0.3× speedup?

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

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

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

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


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

    1. Initial program 97.9%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \frac{x + \left(-1 \cdot \frac{-4 \cdot {x}^{2} + -1 \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)}{\varepsilon} + 4 \cdot x\right)}{\varepsilon} - 1\right) \cdot {\varepsilon}^{5} \]
    4. Applied rewrites94.2%

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
      9. lift-pow.f6499.7

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
    8. Applied rewrites99.7%

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

Alternative 3: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-\left(5 \cdot x + \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
      5. lift-fma.f6493.1

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
      9. lift-pow.f6499.7

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
    8. Applied rewrites99.7%

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

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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-\left(5 \cdot x + \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
      5. lift-fma.f6493.1

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
      9. lift-pow.f6499.7

        \[\leadsto \left(5 \cdot \left({x}^{3} \cdot x\right)\right) \cdot \varepsilon \]
    8. Applied rewrites99.7%

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

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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-\left(5 \cdot x + \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
      5. lift-fma.f6493.1

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-\left(5 \cdot x + \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
      5. lift-fma.f6493.1

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.2%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \frac{x + \left(-1 \cdot \frac{-4 \cdot {x}^{2} + -1 \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)}{\varepsilon} + 4 \cdot x\right)}{\varepsilon} - 1\right) \cdot {\varepsilon}^{5} \]
    4. Applied rewrites94.5%

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

      \[\leadsto -{\varepsilon}^{3} \cdot \left(\left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right) - 6 \cdot {x}^{2}\right) \]
    6. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto -\left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right) \cdot {\varepsilon}^{3} \]
    7. Applied rewrites94.1%

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

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

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

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

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

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

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

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

Alternative 7: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.5%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-\left(5 \cdot x + \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
      5. lift-fma.f6493.1

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 98.2%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \frac{x + \left(-1 \cdot \frac{-4 \cdot {x}^{2} + -1 \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)}{\varepsilon} + 4 \cdot x\right)}{\varepsilon} - 1\right) \cdot {\varepsilon}^{5} \]
    4. Applied rewrites94.5%

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

      \[\leadsto -{\varepsilon}^{3} \cdot \left(\left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right) - 6 \cdot {x}^{2}\right) \]
    6. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto -\left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right) \cdot {\varepsilon}^{3} \]
    7. Applied rewrites94.1%

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

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

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

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

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

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

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

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

Alternative 8: 98.5% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.9%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \frac{x + \left(-1 \cdot \frac{-4 \cdot {x}^{2} + -1 \cdot \left(2 \cdot {x}^{2} + 4 \cdot {x}^{2}\right)}{\varepsilon} + 4 \cdot x\right)}{\varepsilon} - 1\right) \cdot {\varepsilon}^{5} \]
    4. Applied rewrites94.2%

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

      \[\leadsto -{\varepsilon}^{3} \cdot \left(\left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right) - 6 \cdot {x}^{2}\right) \]
    6. Step-by-step derivation
      1. fp-cancel-sub-sign-invN/A

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

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

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

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

        \[\leadsto -\left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right) \cdot {\varepsilon}^{3} \]
    7. Applied rewrites93.7%

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

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

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

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

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

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

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

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 98.2% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 97.9%

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

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

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

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

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

        \[\leadsto -\left(-1 \cdot \left(4 \cdot {x}^{3} + 6 \cdot {x}^{3}\right) + \varepsilon \cdot \left(-6 \cdot {x}^{2} + \left(-4 \cdot {x}^{2} + \varepsilon \cdot \left(-1 \cdot \varepsilon + -1 \cdot \left(x + 4 \cdot x\right)\right)\right)\right)\right) \cdot {\varepsilon}^{2} \]
    6. Applied rewrites93.6%

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

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

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

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

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

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

        \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-1 \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
    8. Applied rewrites93.6%

      \[\leadsto -\mathsf{fma}\left(\mathsf{fma}\left(x \cdot x, -10, \left(-1 \cdot \mathsf{fma}\left(5, x, \varepsilon\right)\right) \cdot \varepsilon\right), \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
    9. Taylor expanded in x around 0

      \[\leadsto -\mathsf{fma}\left(-1 \cdot {\varepsilon}^{2}, \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
    10. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

        \[\leadsto -\mathsf{fma}\left(-\varepsilon \cdot \varepsilon, \varepsilon, -\left(\left(x \cdot x\right) \cdot x\right) \cdot 10\right) \cdot \left(\varepsilon \cdot \varepsilon\right) \]
    11. Applied rewrites92.0%

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

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

    1. Initial program 86.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 82.4% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(\left(\left(5 \cdot x\right) \cdot x\right) \cdot \left(x \cdot x\right)\right) \cdot \varepsilon \end{array} \]
(FPCore (x eps) :precision binary64 (* (* (* (* 5.0 x) x) (* x x)) eps))
double code(double x, double eps) {
	return (((5.0 * x) * x) * (x * x)) * eps;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (((5.0d0 * x) * x) * (x * x)) * eps
end function
public static double code(double x, double eps) {
	return (((5.0 * x) * x) * (x * x)) * eps;
}
def code(x, eps):
	return (((5.0 * x) * x) * (x * x)) * eps
function code(x, eps)
	return Float64(Float64(Float64(Float64(5.0 * x) * x) * Float64(x * x)) * eps)
end
function tmp = code(x, eps)
	tmp = (((5.0 * x) * x) * (x * x)) * eps;
end
code[x_, eps_] := N[(N[(N[(N[(5.0 * x), $MachinePrecision] * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 82.4% accurate, 8.0× speedup?

\[\begin{array}{l} \\ \left(5 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) \cdot \varepsilon \end{array} \]
(FPCore (x eps) :precision binary64 (* (* 5.0 (* (* x x) (* x x))) eps))
double code(double x, double eps) {
	return (5.0 * ((x * x) * (x * x))) * eps;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, eps)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: eps
    code = (5.0d0 * ((x * x) * (x * x))) * eps
end function
public static double code(double x, double eps) {
	return (5.0 * ((x * x) * (x * x))) * eps;
}
def code(x, eps):
	return (5.0 * ((x * x) * (x * x))) * eps
function code(x, eps)
	return Float64(Float64(5.0 * Float64(Float64(x * x) * Float64(x * x))) * eps)
end
function tmp = code(x, eps)
	tmp = (5.0 * ((x * x) * (x * x))) * eps;
end
code[x_, eps_] := N[(N[(5.0 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * eps), $MachinePrecision]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Reproduce

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