Radioactive exchange between two surfaces

Percentage Accurate: 85.7% → 94.9%
Time: 15.0s
Alternatives: 7
Speedup: 10.2×

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: 85.7% 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: 94.9% accurate, 9.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{1}{y \cdot y + x \cdot x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35000000000000003e154

    1. Initial program 57.1%

      \[{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.f6496.4%

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

      \[\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-*.f6496.4%

        \[\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-rr96.4%

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

    if -1.35000000000000003e154 < y

    1. Initial program 91.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-*.f6498.1%

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

      \[\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 \left(x \cdot x - y \cdot y\right) \cdot \frac{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}} \]
      2. clear-numN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x - y \cdot y\right), \color{blue}{\left(\frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\right)\right) \]
      8. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{y \cdot y + \color{blue}{x \cdot x}}\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(1, \color{blue}{\left(y \cdot y + x \cdot x\right)}\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot x + \color{blue}{y \cdot 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(1, \mathsf{+.f64}\left(\left(x \cdot x\right), \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
    6. Applied egg-rr98.1%

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

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

Alternative 2: 89.3% accurate, 7.3× speedup?

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

\\
\begin{array}{l}
t_0 := x \cdot x - y \cdot y\\
t_1 := \frac{t\_0}{\frac{1}{y \cdot y}}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq -9.2 \cdot 10^{-71}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;y \leq 1.2 \cdot 10^{-73}:\\
\;\;\;\;\frac{t\_0}{\frac{\frac{1}{x}}{x}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35000000000000003e154

    1. Initial program 57.1%

      \[{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.f6496.4%

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

      \[\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-*.f6496.4%

        \[\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-rr96.4%

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

    if -1.35000000000000003e154 < y < -9.1999999999999994e-71 or 1.20000000000000003e-73 < y

    1. Initial program 81.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-*.f6496.1%

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

      \[\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 \left(x \cdot x - y \cdot y\right) \cdot \frac{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}} \]
      2. clear-numN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x - y \cdot y\right), \color{blue}{\left(\frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\right)\right) \]
      8. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{y \cdot y + \color{blue}{x \cdot x}}\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(1, \color{blue}{\left(y \cdot y + x \cdot x\right)}\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot x + \color{blue}{y \cdot 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(1, \mathsf{+.f64}\left(\left(x \cdot x\right), \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
    6. Applied egg-rr96.1%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \color{blue}{\left(\frac{1}{{y}^{2}}\right)}\right) \]
    8. Step-by-step derivation
      1. /-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(1, \color{blue}{\left({y}^{2}\right)}\right)\right) \]
      2. 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(1, \left(y \cdot \color{blue}{y}\right)\right)\right) \]
      3. *-lowering-*.f6494.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    9. Simplified94.3%

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

    if -9.1999999999999994e-71 < y < 1.20000000000000003e-73

    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.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(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.8%

      \[\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 \left(x \cdot x - y \cdot y\right) \cdot \frac{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}} \]
      2. clear-numN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x - y \cdot y\right), \color{blue}{\left(\frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\right)\right) \]
      8. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{y \cdot y + \color{blue}{x \cdot x}}\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(1, \color{blue}{\left(y \cdot y + x \cdot x\right)}\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot x + \color{blue}{y \cdot 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(1, \mathsf{+.f64}\left(\left(x \cdot x\right), \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
    6. Applied egg-rr99.9%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \color{blue}{\left(\frac{1}{{x}^{2}}\right)}\right) \]
    8. Step-by-step derivation
      1. /-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(1, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      2. 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(1, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      3. *-lowering-*.f6499.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    9. Simplified99.4%

      \[\leadsto \frac{x \cdot x - y \cdot y}{\color{blue}{\frac{1}{x \cdot x}}} \]
    10. Step-by-step derivation
      1. 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}}{\color{blue}{x}}\right)\right) \]
      2. /-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}\right), \color{blue}{x}\right)\right) \]
      3. /-lowering-/.f6499.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(1, x\right), x\right)\right) \]
    11. Applied egg-rr99.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq -9.2 \cdot 10^{-71}:\\ \;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{1}{y \cdot y}}\\ \mathbf{elif}\;y \leq 1.2 \cdot 10^{-73}:\\ \;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{\frac{1}{x}}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{1}{y \cdot y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 89.3% accurate, 7.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x - y \cdot y}{\frac{1}{y \cdot y}}\\ \mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq -2.9 \cdot 10^{-66}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 7.4 \cdot 10^{-79}:\\ \;\;\;\;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 (/ (- (* x x) (* y y)) (/ 1.0 (* y y)))))
   (if (<= y -1.35e+154)
     (- 0.0 (* y (* y (* y y))))
     (if (<= y -2.9e-66) t_0 (if (<= y 7.4e-79) (* x (* x (* x x))) t_0)))))
double code(double x, double y) {
	double t_0 = ((x * x) - (y * y)) / (1.0 / (y * y));
	double tmp;
	if (y <= -1.35e+154) {
		tmp = 0.0 - (y * (y * (y * y)));
	} else if (y <= -2.9e-66) {
		tmp = t_0;
	} else if (y <= 7.4e-79) {
		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 = ((x * x) - (y * y)) / (1.0d0 / (y * y))
    if (y <= (-1.35d+154)) then
        tmp = 0.0d0 - (y * (y * (y * y)))
    else if (y <= (-2.9d-66)) then
        tmp = t_0
    else if (y <= 7.4d-79) 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 = ((x * x) - (y * y)) / (1.0 / (y * y));
	double tmp;
	if (y <= -1.35e+154) {
		tmp = 0.0 - (y * (y * (y * y)));
	} else if (y <= -2.9e-66) {
		tmp = t_0;
	} else if (y <= 7.4e-79) {
		tmp = x * (x * (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = ((x * x) - (y * y)) / (1.0 / (y * y))
	tmp = 0
	if y <= -1.35e+154:
		tmp = 0.0 - (y * (y * (y * y)))
	elif y <= -2.9e-66:
		tmp = t_0
	elif y <= 7.4e-79:
		tmp = x * (x * (x * x))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(Float64(x * x) - Float64(y * y)) / Float64(1.0 / Float64(y * y)))
	tmp = 0.0
	if (y <= -1.35e+154)
		tmp = Float64(0.0 - Float64(y * Float64(y * Float64(y * y))));
	elseif (y <= -2.9e-66)
		tmp = t_0;
	elseif (y <= 7.4e-79)
		tmp = Float64(x * Float64(x * Float64(x * x)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = ((x * x) - (y * y)) / (1.0 / (y * y));
	tmp = 0.0;
	if (y <= -1.35e+154)
		tmp = 0.0 - (y * (y * (y * y)));
	elseif (y <= -2.9e-66)
		tmp = t_0;
	elseif (y <= 7.4e-79)
		tmp = x * (x * (x * x));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.35e+154], N[(0.0 - N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.9e-66], t$95$0, If[LessEqual[y, 7.4e-79], N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x \cdot x - y \cdot y}{\frac{1}{y \cdot y}}\\
\mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\

\mathbf{elif}\;y \leq -2.9 \cdot 10^{-66}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y \leq 7.4 \cdot 10^{-79}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35000000000000003e154

    1. Initial program 57.1%

      \[{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.f6496.4%

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

      \[\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-*.f6496.4%

        \[\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-rr96.4%

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

    if -1.35000000000000003e154 < y < -2.90000000000000011e-66 or 7.40000000000000035e-79 < y

    1. Initial program 81.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-*.f6496.1%

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

      \[\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 \left(x \cdot x - y \cdot y\right) \cdot \frac{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}} \]
      2. clear-numN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x - y \cdot y\right), \color{blue}{\left(\frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\right)\right) \]
      8. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{y \cdot y + \color{blue}{x \cdot x}}\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(1, \color{blue}{\left(y \cdot y + x \cdot x\right)}\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot x + \color{blue}{y \cdot 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(1, \mathsf{+.f64}\left(\left(x \cdot x\right), \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
    6. Applied egg-rr96.1%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \color{blue}{\left(\frac{1}{{y}^{2}}\right)}\right) \]
    8. Step-by-step derivation
      1. /-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(1, \color{blue}{\left({y}^{2}\right)}\right)\right) \]
      2. 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(1, \left(y \cdot \color{blue}{y}\right)\right)\right) \]
      3. *-lowering-*.f6494.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(y, \color{blue}{y}\right)\right)\right) \]
    9. Simplified94.3%

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

    if -2.90000000000000011e-66 < y < 7.40000000000000035e-79

    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.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(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.8%

      \[\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-*.f6499.4%

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

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

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

Alternative 4: 88.1% accurate, 8.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x \cdot x - y \cdot y}{\frac{1}{x \cdot x}}\\ \mathbf{if}\;x \leq -3.4 \cdot 10^{-39}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-58}:\\ \;\;\;\;0 - 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) (* y y)) (/ 1.0 (* x x)))))
   (if (<= x -3.4e-39)
     t_0
     (if (<= x 2.25e-58) (- 0.0 (* y (* y (* y y)))) t_0))))
double code(double x, double y) {
	double t_0 = ((x * x) - (y * y)) / (1.0 / (x * x));
	double tmp;
	if (x <= -3.4e-39) {
		tmp = t_0;
	} else if (x <= 2.25e-58) {
		tmp = 0.0 - (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) - (y * y)) / (1.0d0 / (x * x))
    if (x <= (-3.4d-39)) then
        tmp = t_0
    else if (x <= 2.25d-58) then
        tmp = 0.0d0 - (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) - (y * y)) / (1.0 / (x * x));
	double tmp;
	if (x <= -3.4e-39) {
		tmp = t_0;
	} else if (x <= 2.25e-58) {
		tmp = 0.0 - (y * (y * (y * y)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = ((x * x) - (y * y)) / (1.0 / (x * x))
	tmp = 0
	if x <= -3.4e-39:
		tmp = t_0
	elif x <= 2.25e-58:
		tmp = 0.0 - (y * (y * (y * y)))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(Float64(x * x) - Float64(y * y)) / Float64(1.0 / Float64(x * x)))
	tmp = 0.0
	if (x <= -3.4e-39)
		tmp = t_0;
	elseif (x <= 2.25e-58)
		tmp = Float64(0.0 - 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) - (y * y)) / (1.0 / (x * x));
	tmp = 0.0;
	if (x <= -3.4e-39)
		tmp = t_0;
	elseif (x <= 2.25e-58)
		tmp = 0.0 - (y * (y * (y * y)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -3.4e-39], t$95$0, If[LessEqual[x, 2.25e-58], N[(0.0 - 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 - y \cdot y}{\frac{1}{x \cdot x}}\\
\mathbf{if}\;x \leq -3.4 \cdot 10^{-39}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq 2.25 \cdot 10^{-58}:\\
\;\;\;\;0 - 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 < -3.3999999999999999e-39 or 2.2500000000000001e-58 < x

    1. Initial program 77.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-*.f6491.2%

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

      \[\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 \left(x \cdot x - y \cdot y\right) \cdot \frac{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}} \]
      2. clear-numN/A

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

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

        \[\leadsto \mathsf{/.f64}\left(\left(x \cdot x - y \cdot y\right), \color{blue}{\left(\frac{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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}{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\color{blue}{\left(y \cdot y\right) \cdot \left(y \cdot y\right)} + \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\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{\left(y \cdot y\right) \cdot \left(y \cdot y\right) + \color{blue}{\left(\left(x \cdot x\right) \cdot \left(x \cdot x\right) - \left(y \cdot y\right) \cdot \left(x \cdot x\right)\right)}}{{\left(y \cdot y\right)}^{3} + {\left(x \cdot x\right)}^{3}}\right)\right) \]
      8. clear-numN/A

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \left(\frac{1}{y \cdot y + \color{blue}{x \cdot x}}\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(1, \color{blue}{\left(y \cdot y + x \cdot x\right)}\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \left(x \cdot x + \color{blue}{y \cdot 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(1, \mathsf{+.f64}\left(\left(x \cdot x\right), \color{blue}{\left(y \cdot y\right)}\right)\right)\right) \]
    6. Applied egg-rr91.2%

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

      \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \color{blue}{\left(\frac{1}{{x}^{2}}\right)}\right) \]
    8. Step-by-step derivation
      1. /-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(1, \color{blue}{\left({x}^{2}\right)}\right)\right) \]
      2. 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(1, \left(x \cdot \color{blue}{x}\right)\right)\right) \]
      3. *-lowering-*.f6485.2%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(x, x\right), \mathsf{*.f64}\left(y, y\right)\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    9. Simplified85.2%

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

    if -3.3999999999999999e-39 < x < 2.2500000000000001e-58

    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.f6497.6%

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

      \[\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-*.f6497.5%

        \[\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-rr97.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{-39}:\\ \;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{1}{x \cdot x}}\\ \mathbf{elif}\;x \leq 2.25 \cdot 10^{-58}:\\ \;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot x - y \cdot y}{\frac{1}{x \cdot x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 94.9% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot x - y \cdot y\right) \cdot \left(y \cdot y + x \cdot x\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.35000000000000003e154

    1. Initial program 57.1%

      \[{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.f6496.4%

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

      \[\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-*.f6496.4%

        \[\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-rr96.4%

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

    if -1.35000000000000003e154 < y

    1. Initial program 91.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-*.f6498.1%

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

      \[\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 simplification97.9%

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

Alternative 6: 80.4% accurate, 10.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{if}\;y \leq -3.4 \cdot 10^{-65}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-62}:\\ \;\;\;\;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 (- 0.0 (* y (* y (* y y))))))
   (if (<= y -3.4e-65) t_0 (if (<= y 2.4e-62) (* x (* x (* x x))) t_0))))
double code(double x, double y) {
	double t_0 = 0.0 - (y * (y * (y * y)));
	double tmp;
	if (y <= -3.4e-65) {
		tmp = t_0;
	} else if (y <= 2.4e-62) {
		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 = 0.0d0 - (y * (y * (y * y)))
    if (y <= (-3.4d-65)) then
        tmp = t_0
    else if (y <= 2.4d-62) 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 = 0.0 - (y * (y * (y * y)));
	double tmp;
	if (y <= -3.4e-65) {
		tmp = t_0;
	} else if (y <= 2.4e-62) {
		tmp = x * (x * (x * x));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.0 - (y * (y * (y * y)))
	tmp = 0
	if y <= -3.4e-65:
		tmp = t_0
	elif y <= 2.4e-62:
		tmp = x * (x * (x * x))
	else:
		tmp = t_0
	return tmp
function code(x, y)
	t_0 = Float64(0.0 - Float64(y * Float64(y * Float64(y * y))))
	tmp = 0.0
	if (y <= -3.4e-65)
		tmp = t_0;
	elseif (y <= 2.4e-62)
		tmp = Float64(x * Float64(x * Float64(x * x)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.0 - (y * (y * (y * y)));
	tmp = 0.0;
	if (y <= -3.4e-65)
		tmp = t_0;
	elseif (y <= 2.4e-62)
		tmp = x * (x * (x * x));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.0 - N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -3.4e-65], t$95$0, If[LessEqual[y, 2.4e-62], N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;y \leq 2.4 \cdot 10^{-62}:\\
\;\;\;\;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 < -3.39999999999999987e-65 or 2.39999999999999984e-62 < y

    1. Initial program 75.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.f6480.5%

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

      \[\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-*.f6480.4%

        \[\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-rr80.4%

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

    if -3.39999999999999987e-65 < y < 2.39999999999999984e-62

    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.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(y, y\right), \mathsf{*.f64}\left(x, \color{blue}{x}\right)\right)\right) \]
    4. Applied egg-rr99.8%

      \[\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-*.f6499.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.4 \cdot 10^{-65}:\\ \;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \mathbf{elif}\;y \leq 2.4 \cdot 10^{-62}:\\ \;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0 - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 57.2% 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 87.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-*.f6495.2%

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

    \[\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-*.f6458.6%

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

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

Reproduce

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