Radioactive exchange between two surfaces

Percentage Accurate: 86.1% → 99.8%
Time: 14.9s
Alternatives: 7
Speedup: 12.1×

Specification

?
\[\begin{array}{l} \\ {x}^{4} - {y}^{4} \end{array} \]
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
double code(double x, double y) {
	return pow(x, 4.0) - pow(y, 4.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x ** 4.0d0) - (y ** 4.0d0)
end function
public static double code(double x, double y) {
	return Math.pow(x, 4.0) - Math.pow(y, 4.0);
}
def code(x, y):
	return math.pow(x, 4.0) - math.pow(y, 4.0)
function code(x, y)
	return Float64((x ^ 4.0) - (y ^ 4.0))
end
function tmp = code(x, y)
	tmp = (x ^ 4.0) - (y ^ 4.0);
end
code[x_, y_] := N[(N[Power[x, 4.0], $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{x}^{4} - {y}^{4}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 7 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: 86.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ {x}^{4} - {y}^{4} \end{array} \]
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
double code(double x, double y) {
	return pow(x, 4.0) - pow(y, 4.0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x ** 4.0d0) - (y ** 4.0d0)
end function
public static double code(double x, double y) {
	return Math.pow(x, 4.0) - Math.pow(y, 4.0);
}
def code(x, y):
	return math.pow(x, 4.0) - math.pow(y, 4.0)
function code(x, y)
	return Float64((x ^ 4.0) - (y ^ 4.0))
end
function tmp = code(x, y)
	tmp = (x ^ 4.0) - (y ^ 4.0);
end
code[x_, y_] := N[(N[Power[x, 4.0], $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
{x}^{4} - {y}^{4}
\end{array}

Alternative 1: 99.8% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \mathbf{if}\;x \leq -1.75 \cdot 10^{+78}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5 \cdot 10^{+63}:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right) - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
   (if (<= x -1.75e+78)
     t_0
     (if (<= x 5e+63) (- (* x (* x (* x x))) (* y (* y (* y y)))) t_0))))
double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -1.75e+78) {
		tmp = t_0;
	} else if (x <= 5e+63) {
		tmp = (x * (x * (x * x))) - (y * (y * (y * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
    if (x <= (-1.75d+78)) then
        tmp = t_0
    else if (x <= 5d+63) then
        tmp = (x * (x * (x * x))) - (y * (y * (y * y)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -1.75e+78) {
		tmp = t_0;
	} else if (x <= 5e+63) {
		tmp = (x * (x * (x * x))) - (y * (y * (y * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y))
	tmp = 0
	if x <= -1.75e+78:
		tmp = t_0
	elif x <= 5e+63:
		tmp = (x * (x * (x * x))) - (y * (y * (y * y)))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y)))
	tmp = 0.0
	if (x <= -1.75e+78)
		tmp = t_0;
	elseif (x <= 5e+63)
		tmp = Float64(Float64(x * Float64(x * Float64(x * x))) - Float64(y * Float64(y * Float64(y * y))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	tmp = 0.0;
	if (x <= -1.75e+78)
		tmp = t_0;
	elseif (x <= 5e+63)
		tmp = (x * (x * (x * x))) - (y * (y * (y * y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.75e+78], t$95$0, If[LessEqual[x, 5e+63], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right) - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.7500000000000001e78 or 5.00000000000000011e63 < x

    1. Initial program 70.7%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6482.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr82.5%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
    5. Step-by-step derivation
      1. flip3--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      4. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      6. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      7. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \color{blue}{y}\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    6. Applied egg-rr82.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot x - y \cdot y}}} \cdot \left(y \cdot y + x \cdot x\right) \]
    7. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{1 \cdot \left(y \cdot y + x \cdot x\right)}{\color{blue}{\frac{1}{x \cdot x - y \cdot y}}} \]
      2. *-lft-identityN/A

        \[\leadsto \frac{y \cdot y + x \cdot x}{\frac{\color{blue}{1}}{x \cdot x - y \cdot y}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot y + x \cdot x\right), \color{blue}{\left(\frac{1}{x \cdot x - y \cdot y}\right)}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x + y \cdot y\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), \left(y \cdot y\right)\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      8. difference-of-squaresN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{\left(x + y\right) \cdot \color{blue}{\left(x - y\right)}}\right)\right) \]
      9. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{\frac{1}{x + y}}{\color{blue}{x - y}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\left(\frac{1}{x + y}\right), \color{blue}{\left(x - y\right)}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x + y\right)\right), \left(\color{blue}{x} - y\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \left(x - y\right)\right)\right) \]
      13. --lowering--.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2}\right)}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
      2. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    11. Simplified100.0%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{\frac{1}{x + y}}{x - y}} \]

    if -1.7500000000000001e78 < x < 5.00000000000000011e63

    1. Initial program 100.0%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\left({x}^{4}\right), \color{blue}{\left({y}^{4}\right)}\right) \]
      2. sqr-powN/A

        \[\leadsto \mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}\right), \left({\color{blue}{y}}^{4}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\left({x}^{2} \cdot {x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{4}\right)\right) \]
      4. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(\left(x \cdot x\right) \cdot {x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{4}\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(x \cdot \left(x \cdot {x}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{y}}^{4}\right)\right) \]
      6. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(x \cdot \left(x \cdot {x}^{2}\right)\right), \left({y}^{4}\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\left(x \cdot \left(x \cdot \left(x \cdot x\right)\right)\right), \left({y}^{4}\right)\right) \]
      8. cube-unmultN/A

        \[\leadsto \mathsf{\_.f64}\left(\left(x \cdot {x}^{3}\right), \left({y}^{4}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left({x}^{3}\right)\right), \left({\color{blue}{y}}^{4}\right)\right) \]
      10. cube-unmultN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot \left(x \cdot x\right)\right)\right), \left({y}^{4}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot {x}^{2}\right)\right), \left({y}^{4}\right)\right) \]
      12. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \left(x \cdot {x}^{\left(\frac{4}{2}\right)}\right)\right), \left({y}^{4}\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right), \left({y}^{4}\right)\right) \]
      14. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left({x}^{2}\right)\right)\right), \left({y}^{4}\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(x \cdot x\right)\right)\right), \left({y}^{4}\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left({y}^{4}\right)\right) \]
      17. sqr-powN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left({y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left({y}^{2} \cdot {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(\left(y \cdot y\right) \cdot {\color{blue}{y}}^{\left(\frac{4}{2}\right)}\right)\right) \]
      20. associate-*l*N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(y \cdot \color{blue}{\left(y \cdot {y}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      21. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(y \cdot \left(y \cdot {y}^{2}\right)\right)\right) \]
      22. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(y \cdot \left(y \cdot \left(y \cdot \color{blue}{y}\right)\right)\right)\right) \]
      23. cube-unmultN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \left(y \cdot {y}^{\color{blue}{3}}\right)\right) \]
      24. *-lowering-*.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \mathsf{*.f64}\left(y, \color{blue}{\left({y}^{3}\right)}\right)\right) \]
      25. cube-unmultN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \mathsf{*.f64}\left(y, \left(y \cdot \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
      26. unpow2N/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \mathsf{*.f64}\left(y, \left(y \cdot {y}^{\color{blue}{2}}\right)\right)\right) \]
      27. metadata-evalN/A

        \[\leadsto \mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, x\right)\right)\right), \mathsf{*.f64}\left(y, \left(y \cdot {y}^{\left(\frac{4}{\color{blue}{2}}\right)}\right)\right)\right) \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{x \cdot \left(x \cdot \left(x \cdot x\right)\right) - y \cdot \left(y \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 2: 99.7% accurate, 8.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \mathbf{if}\;x \leq -1 \cdot 10^{+158}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+63}:\\ \;\;\;\;\left(x \cdot x - y \cdot y\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
   (if (<= x -1e+158)
     t_0
     (if (<= x 5.6e+63) (* (- (* x x) (* y y)) (+ (* x x) (* y y))) t_0))))
double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -1e+158) {
		tmp = t_0;
	} else if (x <= 5.6e+63) {
		tmp = ((x * x) - (y * y)) * ((x * x) + (y * y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
    if (x <= (-1d+158)) then
        tmp = t_0
    else if (x <= 5.6d+63) then
        tmp = ((x * x) - (y * y)) * ((x * x) + (y * y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -1e+158) {
		tmp = t_0;
	} else if (x <= 5.6e+63) {
		tmp = ((x * x) - (y * y)) * ((x * x) + (y * y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y))
	tmp = 0
	if x <= -1e+158:
		tmp = t_0
	elif x <= 5.6e+63:
		tmp = ((x * x) - (y * y)) * ((x * x) + (y * y))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y)))
	tmp = 0.0
	if (x <= -1e+158)
		tmp = t_0;
	elseif (x <= 5.6e+63)
		tmp = Float64(Float64(Float64(x * x) - Float64(y * y)) * Float64(Float64(x * x) + Float64(y * y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	tmp = 0.0;
	if (x <= -1e+158)
		tmp = t_0;
	elseif (x <= 5.6e+63)
		tmp = ((x * x) - (y * y)) * ((x * x) + (y * y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+158], t$95$0, If[LessEqual[x, 5.6e+63], N[(N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 5.6 \cdot 10^{+63}:\\
\;\;\;\;\left(x \cdot x - y \cdot y\right) \cdot \left(x \cdot x + y \cdot y\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -9.99999999999999953e157 or 5.59999999999999974e63 < x

    1. Initial program 69.2%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6479.4%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr79.4%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
    5. Step-by-step derivation
      1. flip3--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      4. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      6. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      7. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \color{blue}{y}\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    6. Applied egg-rr79.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot x - y \cdot y}}} \cdot \left(y \cdot y + x \cdot x\right) \]
    7. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{1 \cdot \left(y \cdot y + x \cdot x\right)}{\color{blue}{\frac{1}{x \cdot x - y \cdot y}}} \]
      2. *-lft-identityN/A

        \[\leadsto \frac{y \cdot y + x \cdot x}{\frac{\color{blue}{1}}{x \cdot x - y \cdot y}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot y + x \cdot x\right), \color{blue}{\left(\frac{1}{x \cdot x - y \cdot y}\right)}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x + y \cdot y\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), \left(y \cdot y\right)\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      8. difference-of-squaresN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{\left(x + y\right) \cdot \color{blue}{\left(x - y\right)}}\right)\right) \]
      9. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{\frac{1}{x + y}}{\color{blue}{x - y}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\left(\frac{1}{x + y}\right), \color{blue}{\left(x - y\right)}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x + y\right)\right), \left(\color{blue}{x} - y\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \left(x - y\right)\right)\right) \]
      13. --lowering--.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    8. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2}\right)}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
      2. *-lowering-*.f64100.0%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    11. Simplified100.0%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{\frac{1}{x + y}}{x - y}} \]

    if -9.99999999999999953e157 < x < 5.59999999999999974e63

    1. Initial program 98.3%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6499.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+158}:\\ \;\;\;\;\frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \mathbf{elif}\;x \leq 5.6 \cdot 10^{+63}:\\ \;\;\;\;\left(x \cdot x - y \cdot y\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 93.5% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \mathbf{if}\;x \leq -6.4 \cdot 10^{-15}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-66}:\\ \;\;\;\;y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
   (if (<= x -6.4e-15)
     t_0
     (if (<= x 9.5e-66) (* y (* (* y y) (- 0.0 y))) t_0))))
double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -6.4e-15) {
		tmp = t_0;
	} else if (x <= 9.5e-66) {
		tmp = y * ((y * y) * (0.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
    if (x <= (-6.4d-15)) then
        tmp = t_0
    else if (x <= 9.5d-66) then
        tmp = y * ((y * y) * (0.0d0 - y))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	double tmp;
	if (x <= -6.4e-15) {
		tmp = t_0;
	} else if (x <= 9.5e-66) {
		tmp = y * ((y * y) * (0.0 - y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y))
	tmp = 0
	if x <= -6.4e-15:
		tmp = t_0
	elif x <= 9.5e-66:
		tmp = y * ((y * y) * (0.0 - y))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y)))
	tmp = 0.0
	if (x <= -6.4e-15)
		tmp = t_0;
	elseif (x <= 9.5e-66)
		tmp = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
	tmp = 0.0;
	if (x <= -6.4e-15)
		tmp = t_0;
	elseif (x <= 9.5e-66)
		tmp = y * ((y * y) * (0.0 - y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e-15], t$95$0, If[LessEqual[x, 9.5e-66], N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 9.5 \cdot 10^{-66}:\\
\;\;\;\;y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.3999999999999999e-15 or 9.5000000000000004e-66 < x

    1. Initial program 81.6%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6488.9%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr88.9%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
    5. Step-by-step derivation
      1. flip3--N/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      2. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      4. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      5. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      6. cube-unmultN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      7. swap-sqrN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
      8. clear-numN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \color{blue}{y}\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    6. Applied egg-rr88.9%

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot x - y \cdot y}}} \cdot \left(y \cdot y + x \cdot x\right) \]
    7. Step-by-step derivation
      1. associate-*l/N/A

        \[\leadsto \frac{1 \cdot \left(y \cdot y + x \cdot x\right)}{\color{blue}{\frac{1}{x \cdot x - y \cdot y}}} \]
      2. *-lft-identityN/A

        \[\leadsto \frac{y \cdot y + x \cdot x}{\frac{\color{blue}{1}}{x \cdot x - y \cdot y}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(y \cdot y + x \cdot x\right), \color{blue}{\left(\frac{1}{x \cdot x - y \cdot y}\right)}\right) \]
      4. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x + y \cdot y\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      5. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), \left(y \cdot y\right)\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
      8. difference-of-squaresN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{\left(x + y\right) \cdot \color{blue}{\left(x - y\right)}}\right)\right) \]
      9. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{\frac{1}{x + y}}{\color{blue}{x - y}}\right)\right) \]
      10. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\left(\frac{1}{x + y}\right), \color{blue}{\left(x - y\right)}\right)\right) \]
      11. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x + y\right)\right), \left(\color{blue}{x} - y\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \left(x - y\right)\right)\right) \]
      13. --lowering--.f6499.9%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
    8. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}} \]
    9. Taylor expanded in x around inf

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left({x}^{2}\right)}, \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
      2. *-lowering-*.f6495.5%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(\color{blue}{\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right)}, \mathsf{\_.f64}\left(x, y\right)\right)\right) \]
    11. Simplified95.5%

      \[\leadsto \frac{\color{blue}{x \cdot x}}{\frac{\frac{1}{x + y}}{x - y}} \]

    if -6.3999999999999999e-15 < x < 9.5000000000000004e-66

    1. Initial program 100.0%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot {y}^{4}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{{y}^{4}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left({y}^{4}\right)}\right) \]
      4. pow-lowering-pow.f6498.9%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{pow.f64}\left(y, \color{blue}{4}\right)\right) \]
    5. Simplified98.9%

      \[\leadsto \color{blue}{0 - {y}^{4}} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{4}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{\left(3 + 1\right)}\right)\right) \]
      4. pow-plusN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{3} \cdot y\right)\right) \]
      5. cube-unmultN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\left(y \cdot \left(y \cdot y\right)\right) \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \left(y \cdot y\right)\right)\right)\right) \]
      9. *-lowering-*.f6498.9%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, y\right)\right)\right)\right) \]
    7. Applied egg-rr98.9%

      \[\leadsto \color{blue}{-y \cdot \left(y \cdot \left(y \cdot y\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.4 \cdot 10^{-15}:\\ \;\;\;\;\frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-66}:\\ \;\;\;\;y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 82.1% accurate, 10.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\ \mathbf{if}\;y \leq -4 \cdot 10^{-18}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 1.36 \cdot 10^{+19}:\\ \;\;\;\;\frac{x \cdot x}{\frac{1}{x \cdot x}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* (* y y) (- 0.0 y)))))
   (if (<= y -4e-18)
     t_0
     (if (<= y 1.36e+19) (/ (* x x) (/ 1.0 (* x x))) t_0))))
double code(double x, double y) {
	double t_0 = y * ((y * y) * (0.0 - y));
	double tmp;
	if (y <= -4e-18) {
		tmp = t_0;
	} else if (y <= 1.36e+19) {
		tmp = (x * x) / (1.0 / (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * ((y * y) * (0.0d0 - y))
    if (y <= (-4d-18)) then
        tmp = t_0
    else if (y <= 1.36d+19) then
        tmp = (x * x) / (1.0d0 / (x * x))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * ((y * y) * (0.0 - y));
	double tmp;
	if (y <= -4e-18) {
		tmp = t_0;
	} else if (y <= 1.36e+19) {
		tmp = (x * x) / (1.0 / (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = y * ((y * y) * (0.0 - y))
	tmp = 0
	if y <= -4e-18:
		tmp = t_0
	elif y <= 1.36e+19:
		tmp = (x * x) / (1.0 / (x * x))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y)))
	tmp = 0.0
	if (y <= -4e-18)
		tmp = t_0;
	elseif (y <= 1.36e+19)
		tmp = Float64(Float64(x * x) / Float64(1.0 / Float64(x * x)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * ((y * y) * (0.0 - y));
	tmp = 0.0;
	if (y <= -4e-18)
		tmp = t_0;
	elseif (y <= 1.36e+19)
		tmp = (x * x) / (1.0 / (x * x));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e-18], t$95$0, If[LessEqual[y, 1.36e+19], N[(N[(x * x), $MachinePrecision] / N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 1.36 \cdot 10^{+19}:\\
\;\;\;\;\frac{x \cdot x}{\frac{1}{x \cdot x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.0000000000000003e-18 or 1.36e19 < y

    1. Initial program 78.9%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot {y}^{4}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{{y}^{4}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left({y}^{4}\right)}\right) \]
      4. pow-lowering-pow.f6482.8%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{pow.f64}\left(y, \color{blue}{4}\right)\right) \]
    5. Simplified82.8%

      \[\leadsto \color{blue}{0 - {y}^{4}} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{4}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{\left(3 + 1\right)}\right)\right) \]
      4. pow-plusN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{3} \cdot y\right)\right) \]
      5. cube-unmultN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\left(y \cdot \left(y \cdot y\right)\right) \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \left(y \cdot y\right)\right)\right)\right) \]
      9. *-lowering-*.f6482.7%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, y\right)\right)\right)\right) \]
    7. Applied egg-rr82.7%

      \[\leadsto \color{blue}{-y \cdot \left(y \cdot \left(y \cdot y\right)\right)} \]

    if -4.0000000000000003e-18 < y < 1.36e19

    1. Initial program 100.0%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6499.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{4}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto {x}^{\left(2 \cdot \color{blue}{2}\right)} \]
      2. pow-sqrN/A

        \[\leadsto {x}^{2} \cdot \color{blue}{{x}^{2}} \]
      3. unpow2N/A

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

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

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

        \[\leadsto x \cdot {x}^{\color{blue}{3}} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{3}\right)}\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
      9. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      12. *-lowering-*.f6493.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    7. Simplified93.1%

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

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

        \[\leadsto \mathsf{*.f64}\left(\left(x \cdot x\right), \color{blue}{\left(x \cdot x\right)}\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(\color{blue}{x} \cdot x\right)\right) \]
      4. *-lowering-*.f6493.1%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right) \]
    9. Applied egg-rr93.1%

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(x \cdot x\right)} \]
    10. Step-by-step derivation
      1. remove-double-divN/A

        \[\leadsto \left(x \cdot x\right) \cdot \frac{1}{\color{blue}{\frac{1}{x \cdot x}}} \]
      2. un-div-invN/A

        \[\leadsto \frac{x \cdot x}{\color{blue}{\frac{1}{x \cdot x}}} \]
      3. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x\right), \color{blue}{\left(\frac{1}{x \cdot x}\right)}\right) \]
      4. *-lowering-*.f64N/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(1, \color{blue}{\left(x \cdot x\right)}\right)\right) \]
      6. *-lowering-*.f6493.1%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    11. Applied egg-rr93.1%

      \[\leadsto \color{blue}{\frac{x \cdot x}{\frac{1}{x \cdot x}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification87.9%

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

Alternative 5: 82.2% accurate, 10.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\ \mathbf{if}\;y \leq -8.8 \cdot 10^{-16}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 5.6 \cdot 10^{+19}:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* (* y y) (- 0.0 y)))))
   (if (<= y -8.8e-16) t_0 (if (<= y 5.6e+19) (* x (* x (* x x))) t_0))))
double code(double x, double y) {
	double t_0 = y * ((y * y) * (0.0 - y));
	double tmp;
	if (y <= -8.8e-16) {
		tmp = t_0;
	} else if (y <= 5.6e+19) {
		tmp = x * (x * (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y * ((y * y) * (0.0d0 - y))
    if (y <= (-8.8d-16)) then
        tmp = t_0
    else if (y <= 5.6d+19) then
        tmp = x * (x * (x * x))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * ((y * y) * (0.0 - y));
	double tmp;
	if (y <= -8.8e-16) {
		tmp = t_0;
	} else if (y <= 5.6e+19) {
		tmp = x * (x * (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = y * ((y * y) * (0.0 - y))
	tmp = 0
	if y <= -8.8e-16:
		tmp = t_0
	elif y <= 5.6e+19:
		tmp = x * (x * (x * x))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y)))
	tmp = 0.0
	if (y <= -8.8e-16)
		tmp = t_0;
	elseif (y <= 5.6e+19)
		tmp = Float64(x * Float64(x * Float64(x * x)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * ((y * y) * (0.0 - y));
	tmp = 0.0;
	if (y <= -8.8e-16)
		tmp = t_0;
	elseif (y <= 5.6e+19)
		tmp = x * (x * (x * x));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.8e-16], t$95$0, If[LessEqual[y, 5.6e+19], N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\
\mathbf{if}\;y \leq -8.8 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 5.6 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -8.80000000000000001e-16 or 5.6e19 < y

    1. Initial program 78.9%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \color{blue}{-1 \cdot {y}^{4}} \]
    4. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-sub0N/A

        \[\leadsto 0 - \color{blue}{{y}^{4}} \]
      3. --lowering--.f64N/A

        \[\leadsto \mathsf{\_.f64}\left(0, \color{blue}{\left({y}^{4}\right)}\right) \]
      4. pow-lowering-pow.f6482.8%

        \[\leadsto \mathsf{\_.f64}\left(0, \mathsf{pow.f64}\left(y, \color{blue}{4}\right)\right) \]
    5. Simplified82.8%

      \[\leadsto \color{blue}{0 - {y}^{4}} \]
    6. Step-by-step derivation
      1. sub0-negN/A

        \[\leadsto \mathsf{neg}\left({y}^{4}\right) \]
      2. neg-lowering-neg.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{4}\right)\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{\left(3 + 1\right)}\right)\right) \]
      4. pow-plusN/A

        \[\leadsto \mathsf{neg.f64}\left(\left({y}^{3} \cdot y\right)\right) \]
      5. cube-unmultN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(\left(y \cdot \left(y \cdot y\right)\right) \cdot y\right)\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{neg.f64}\left(\left(y \cdot \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \left(y \cdot \left(y \cdot y\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \left(y \cdot y\right)\right)\right)\right) \]
      9. *-lowering-*.f6482.7%

        \[\leadsto \mathsf{neg.f64}\left(\mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, \mathsf{*.f64}\left(y, y\right)\right)\right)\right) \]
    7. Applied egg-rr82.7%

      \[\leadsto \color{blue}{-y \cdot \left(y \cdot \left(y \cdot y\right)\right)} \]

    if -8.80000000000000001e-16 < y < 5.6e19

    1. Initial program 100.0%

      \[{x}^{4} - {y}^{4} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
      2. sqr-powN/A

        \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
      3. difference-of-squaresN/A

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

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

        \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      8. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      10. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
      13. +-commutativeN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
      14. +-lowering-+.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
      15. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      16. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
      18. metadata-evalN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
      19. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      20. *-lowering-*.f6499.7%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
    5. Taylor expanded in x around inf

      \[\leadsto \color{blue}{{x}^{4}} \]
    6. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto {x}^{\left(2 \cdot \color{blue}{2}\right)} \]
      2. pow-sqrN/A

        \[\leadsto {x}^{2} \cdot \color{blue}{{x}^{2}} \]
      3. unpow2N/A

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

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

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

        \[\leadsto x \cdot {x}^{\color{blue}{3}} \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{3}\right)}\right) \]
      8. cube-multN/A

        \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
      9. unpow2N/A

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

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      11. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      12. *-lowering-*.f6493.1%

        \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    7. Simplified93.1%

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

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

Alternative 6: 99.8% accurate, 12.1× speedup?

\[\begin{array}{l} \\ \frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (+ (* x x) (* y y)) (/ (/ 1.0 (+ x y)) (- x y))))
double code(double x, double y) {
	return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x * x) + (y * y)) / ((1.0d0 / (x + y)) / (x - y))
end function
public static double code(double x, double y) {
	return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y));
}
def code(x, y):
	return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y))
function code(x, y)
	return Float64(Float64(Float64(x * x) + Float64(y * y)) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y)))
end
function tmp = code(x, y)
	tmp = ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y));
end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}
\end{array}
Derivation
  1. Initial program 89.5%

    \[{x}^{4} - {y}^{4} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqr-powN/A

      \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
    2. sqr-powN/A

      \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
    3. difference-of-squaresN/A

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

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

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    13. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
    14. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    16. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    17. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    18. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
    19. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
    20. *-lowering-*.f6493.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr93.5%

    \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
  5. Step-by-step derivation
    1. flip3--N/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    2. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\left(\frac{1}{\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}}\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{{\left(x \cdot x\right)}^{3} - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\color{blue}{\mathsf{*.f64}\left(y, y\right)}, \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    4. cube-unmultN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    5. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - {\left(y \cdot y\right)}^{3}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    6. cube-unmultN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot y\right) \cdot \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    7. swap-sqrN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
    8. clear-numN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{1}{\frac{\left(x \cdot \left(x \cdot x\right)\right) \cdot \left(x \cdot \left(x \cdot x\right)\right) - \left(y \cdot \left(y \cdot y\right)\right) \cdot \left(y \cdot \left(y \cdot y\right)\right)}{\left(x \cdot x\right) \cdot \left(x \cdot x\right) + \left(\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(x \cdot x\right) \cdot \left(y \cdot y\right)\right)}}\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, \color{blue}{y}\right), \mathsf{*.f64}\left(x, x\right)\right)\right) \]
  6. Applied egg-rr93.5%

    \[\leadsto \color{blue}{\frac{1}{\frac{1}{x \cdot x - y \cdot y}}} \cdot \left(y \cdot y + x \cdot x\right) \]
  7. Step-by-step derivation
    1. associate-*l/N/A

      \[\leadsto \frac{1 \cdot \left(y \cdot y + x \cdot x\right)}{\color{blue}{\frac{1}{x \cdot x - y \cdot y}}} \]
    2. *-lft-identityN/A

      \[\leadsto \frac{y \cdot y + x \cdot x}{\frac{\color{blue}{1}}{x \cdot x - y \cdot y}} \]
    3. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\left(y \cdot y + x \cdot x\right), \color{blue}{\left(\frac{1}{x \cdot x - y \cdot y}\right)}\right) \]
    4. +-commutativeN/A

      \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x + y \cdot y\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
    5. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(x \cdot x\right), \left(y \cdot y\right)\right), \left(\frac{\color{blue}{1}}{x \cdot x - y \cdot y}\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{x \cdot x - y \cdot y}\right)\right) \]
    8. difference-of-squaresN/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{\left(x + y\right) \cdot \color{blue}{\left(x - y\right)}}\right)\right) \]
    9. associate-/r*N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{\frac{1}{x + y}}{\color{blue}{x - y}}\right)\right) \]
    10. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\left(\frac{1}{x + y}\right), \color{blue}{\left(x - y\right)}\right)\right) \]
    11. /-lowering-/.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \left(x + y\right)\right), \left(\color{blue}{x} - y\right)\right)\right) \]
    12. +-lowering-+.f64N/A

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \left(x - y\right)\right)\right) \]
    13. --lowering--.f6499.8%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(\mathsf{/.f64}\left(1, \mathsf{+.f64}\left(x, y\right)\right), \mathsf{\_.f64}\left(x, \color{blue}{y}\right)\right)\right) \]
  8. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}} \]
  9. Add Preprocessing

Alternative 7: 57.3% accurate, 29.3× speedup?

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

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

    \[{x}^{4} - {y}^{4} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. sqr-powN/A

      \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {\color{blue}{y}}^{4} \]
    2. sqr-powN/A

      \[\leadsto {x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)} \cdot \color{blue}{{y}^{\left(\frac{4}{2}\right)}} \]
    3. difference-of-squaresN/A

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

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

      \[\leadsto \mathsf{*.f64}\left(\left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)}\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{\left(\frac{4}{2}\right)}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left(\color{blue}{{x}^{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left({x}^{2}\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    8. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(x \cdot x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{\left(\frac{4}{2}\right)}\right)\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    10. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left({y}^{2}\right)\right), \left({x}^{\left(\frac{4}{\color{blue}{2}}\right)} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \left(y \cdot y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    12. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({x}^{\color{blue}{\left(\frac{4}{2}\right)}} + {y}^{\left(\frac{4}{2}\right)}\right)\right) \]
    13. +-commutativeN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left({y}^{\left(\frac{4}{2}\right)} + \color{blue}{{x}^{\left(\frac{4}{2}\right)}}\right)\right) \]
    14. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{\left(\frac{4}{2}\right)}\right), \color{blue}{\left({x}^{\left(\frac{4}{2}\right)}\right)}\right)\right) \]
    15. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left({y}^{2}\right), \left({x}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    16. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\left(y \cdot y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    17. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({\color{blue}{x}}^{\left(\frac{4}{2}\right)}\right)\right)\right) \]
    18. metadata-evalN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left({x}^{2}\right)\right)\right) \]
    19. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \left(x \cdot \color{blue}{x}\right)\right)\right) \]
    20. *-lowering-*.f6493.5%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  4. Applied egg-rr93.5%

    \[\leadsto \color{blue}{\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)} \]
  5. Taylor expanded in x around inf

    \[\leadsto \color{blue}{{x}^{4}} \]
  6. Step-by-step derivation
    1. metadata-evalN/A

      \[\leadsto {x}^{\left(2 \cdot \color{blue}{2}\right)} \]
    2. pow-sqrN/A

      \[\leadsto {x}^{2} \cdot \color{blue}{{x}^{2}} \]
    3. unpow2N/A

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

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

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

      \[\leadsto x \cdot {x}^{\color{blue}{3}} \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{3}\right)}\right) \]
    8. cube-multN/A

      \[\leadsto \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{\left(x \cdot x\right)}\right)\right) \]
    9. unpow2N/A

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

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
    11. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
    12. *-lowering-*.f6455.7%

      \[\leadsto \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
  7. Simplified55.7%

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

Reproduce

?
herbie shell --seed 2024192 
(FPCore (x y)
  :name "Radioactive exchange between two surfaces"
  :precision binary64
  (- (pow x 4.0) (pow y 4.0)))