Radioactive exchange between two surfaces

Percentage Accurate: 85.5% → 94.7%
Time: 4.0s
Alternatives: 5
Speedup: 12.0×

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 5 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.5% 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.7% accurate, 12.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := x \cdot x + y \cdot y\\ \mathbf{if}\;x \leq 5.8 \cdot 10^{+145}:\\ \;\;\;\;t_0 \cdot \left(x \cdot x - y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot t_0\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ (* x x) (* y y))))
   (if (<= x 5.8e+145) (* t_0 (- (* x x) (* y y))) (* (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (x * x) + (y * y);
	double tmp;
	if (x <= 5.8e+145) {
		tmp = t_0 * ((x * x) - (y * y));
	} else {
		tmp = (x * x) * 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)
    if (x <= 5.8d+145) then
        tmp = t_0 * ((x * x) - (y * y))
    else
        tmp = (x * x) * t_0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (x * x) + (y * y);
	double tmp;
	if (x <= 5.8e+145) {
		tmp = t_0 * ((x * x) - (y * y));
	} else {
		tmp = (x * x) * t_0;
	}
	return tmp;
}
def code(x, y):
	t_0 = (x * x) + (y * y)
	tmp = 0
	if x <= 5.8e+145:
		tmp = t_0 * ((x * x) - (y * y))
	else:
		tmp = (x * x) * t_0
	return tmp
function code(x, y)
	t_0 = Float64(Float64(x * x) + Float64(y * y))
	tmp = 0.0
	if (x <= 5.8e+145)
		tmp = Float64(t_0 * Float64(Float64(x * x) - Float64(y * y)));
	else
		tmp = Float64(Float64(x * x) * t_0);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (x * x) + (y * y);
	tmp = 0.0;
	if (x <= 5.8e+145)
		tmp = t_0 * ((x * x) - (y * y));
	else
		tmp = (x * x) * t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 5.8e+145], N[(t$95$0 * N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * t$95$0), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := x \cdot x + y \cdot y\\
\mathbf{if}\;x \leq 5.8 \cdot 10^{+145}:\\
\;\;\;\;t_0 \cdot \left(x \cdot x - y \cdot y\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot x\right) \cdot t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < 5.8000000000000001e145

    1. Initial program 90.3%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow90.1%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow90.0%

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

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

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

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

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow298.3%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow298.3%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow298.3%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr98.3%

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

    if 5.8000000000000001e145 < x

    1. Initial program 65.0%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow65.0%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow65.0%

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

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

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

        \[\leadsto \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      6. metadata-eval75.0%

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow275.0%

        \[\leadsto \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      8. metadata-eval75.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow275.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      10. metadata-eval75.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow275.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr75.0%

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

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow287.5%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    6. Simplified87.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq 5.8 \cdot 10^{+145}:\\ \;\;\;\;\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \]

Alternative 2: 79.3% accurate, 12.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{+109} \lor \neg \left(y \leq 1.05 \cdot 10^{-57}\right):\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(y \cdot \left(-y\right) - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -1.95e+109) (not (<= y 1.05e-57)))
   (* (* y y) (- (* y (- y)) (* x x)))
   (* (* x x) (+ (* x x) (* y y)))))
double code(double x, double y) {
	double tmp;
	if ((y <= -1.95e+109) || !(y <= 1.05e-57)) {
		tmp = (y * y) * ((y * -y) - (x * x));
	} else {
		tmp = (x * x) * ((x * x) + (y * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-1.95d+109)) .or. (.not. (y <= 1.05d-57))) then
        tmp = (y * y) * ((y * -y) - (x * x))
    else
        tmp = (x * x) * ((x * x) + (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -1.95e+109) || !(y <= 1.05e-57)) {
		tmp = (y * y) * ((y * -y) - (x * x));
	} else {
		tmp = (x * x) * ((x * x) + (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -1.95e+109) or not (y <= 1.05e-57):
		tmp = (y * y) * ((y * -y) - (x * x))
	else:
		tmp = (x * x) * ((x * x) + (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -1.95e+109) || !(y <= 1.05e-57))
		tmp = Float64(Float64(y * y) * Float64(Float64(y * Float64(-y)) - Float64(x * x)));
	else
		tmp = Float64(Float64(x * x) * Float64(Float64(x * x) + Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -1.95e+109) || ~((y <= 1.05e-57)))
		tmp = (y * y) * ((y * -y) - (x * x));
	else
		tmp = (x * x) * ((x * x) + (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -1.95e+109], N[Not[LessEqual[y, 1.05e-57]], $MachinePrecision]], N[(N[(y * y), $MachinePrecision] * N[(N[(y * (-y)), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{+109} \lor \neg \left(y \leq 1.05 \cdot 10^{-57}\right):\\
\;\;\;\;\left(y \cdot y\right) \cdot \left(y \cdot \left(-y\right) - x \cdot x\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.95000000000000008e109 or 1.05e-57 < y

    1. Initial program 75.0%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow75.0%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow74.9%

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

        \[\leadsto \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right)} \]
      4. metadata-eval88.7%

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow288.7%

        \[\leadsto \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      6. metadata-eval88.7%

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow288.7%

        \[\leadsto \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      8. metadata-eval88.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow288.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      10. metadata-eval88.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow288.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr88.7%

      \[\leadsto \color{blue}{\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)} \]
    4. Taylor expanded in x around 0 84.4%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(-1 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. mul-1-neg84.4%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(-y \cdot y\right)} \]
      3. distribute-rgt-neg-out84.4%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(y \cdot \left(-y\right)\right)} \]
    6. Simplified84.4%

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

    if -1.95000000000000008e109 < y < 1.05e-57

    1. Initial program 95.7%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow95.5%

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

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

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

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow299.7%

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

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow299.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr99.7%

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

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow288.6%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    6. Simplified88.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.95 \cdot 10^{+109} \lor \neg \left(y \leq 1.05 \cdot 10^{-57}\right):\\ \;\;\;\;\left(y \cdot y\right) \cdot \left(y \cdot \left(-y\right) - x \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \]

Alternative 3: 69.0% accurate, 13.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+110} \lor \neg \left(y \leq 1.22 \cdot 10^{+126}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -3.1e+110) (not (<= y 1.22e+126)))
   (* (* x x) (* y (- y)))
   (* (* x x) (+ (* x x) (* y y)))))
double code(double x, double y) {
	double tmp;
	if ((y <= -3.1e+110) || !(y <= 1.22e+126)) {
		tmp = (x * x) * (y * -y);
	} else {
		tmp = (x * x) * ((x * x) + (y * y));
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-3.1d+110)) .or. (.not. (y <= 1.22d+126))) then
        tmp = (x * x) * (y * -y)
    else
        tmp = (x * x) * ((x * x) + (y * y))
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -3.1e+110) || !(y <= 1.22e+126)) {
		tmp = (x * x) * (y * -y);
	} else {
		tmp = (x * x) * ((x * x) + (y * y));
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -3.1e+110) or not (y <= 1.22e+126):
		tmp = (x * x) * (y * -y)
	else:
		tmp = (x * x) * ((x * x) + (y * y))
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -3.1e+110) || !(y <= 1.22e+126))
		tmp = Float64(Float64(x * x) * Float64(y * Float64(-y)));
	else
		tmp = Float64(Float64(x * x) * Float64(Float64(x * x) + Float64(y * y)));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -3.1e+110) || ~((y <= 1.22e+126)))
		tmp = (x * x) * (y * -y);
	else
		tmp = (x * x) * ((x * x) + (y * y));
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -3.1e+110], N[Not[LessEqual[y, 1.22e+126]], $MachinePrecision]], N[(N[(x * x), $MachinePrecision] * N[(y * (-y)), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.1 \cdot 10^{+110} \lor \neg \left(y \leq 1.22 \cdot 10^{+126}\right):\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -3.10000000000000017e110 or 1.21999999999999995e126 < y

    1. Initial program 68.8%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow68.8%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow68.8%

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

        \[\leadsto \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right)} \]
      4. metadata-eval83.8%

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow283.8%

        \[\leadsto \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      6. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow283.8%

        \[\leadsto \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      8. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow283.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      10. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow283.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr83.8%

      \[\leadsto \color{blue}{\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)} \]
    4. Taylor expanded in x around 0 90.0%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {y}^{2}\right)} \]
    5. Step-by-step derivation
      1. unpow290.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(-1 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. mul-1-neg90.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(-y \cdot y\right)} \]
      3. distribute-rgt-neg-out90.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(y \cdot \left(-y\right)\right)} \]
    6. Simplified90.0%

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

      \[\leadsto \color{blue}{-1 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg61.7%

        \[\leadsto \color{blue}{-{y}^{2} \cdot {x}^{2}} \]
      2. unpow261.7%

        \[\leadsto -\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2} \]
      3. unpow261.7%

        \[\leadsto -\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      4. *-commutative61.7%

        \[\leadsto -\color{blue}{\left(x \cdot x\right) \cdot \left(y \cdot y\right)} \]
    9. Simplified61.7%

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

    if -3.10000000000000017e110 < y < 1.21999999999999995e126

    1. Initial program 94.3%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow94.1%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow94.0%

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

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

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow299.7%

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

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow299.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr99.7%

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

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow276.5%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    6. Simplified76.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -3.1 \cdot 10^{+110} \lor \neg \left(y \leq 1.22 \cdot 10^{+126}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(x \cdot x + y \cdot y\right)\\ \end{array} \]

Alternative 4: 44.6% accurate, 16.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+109} \lor \neg \left(y \leq 1.25 \cdot 10^{+126}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot y\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (or (<= y -4.8e+109) (not (<= y 1.25e+126)))
   (* (* x x) (* y (- y)))
   (* (* x x) (* y y))))
double code(double x, double y) {
	double tmp;
	if ((y <= -4.8e+109) || !(y <= 1.25e+126)) {
		tmp = (x * x) * (y * -y);
	} else {
		tmp = (x * x) * (y * y);
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((y <= (-4.8d+109)) .or. (.not. (y <= 1.25d+126))) then
        tmp = (x * x) * (y * -y)
    else
        tmp = (x * x) * (y * y)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if ((y <= -4.8e+109) || !(y <= 1.25e+126)) {
		tmp = (x * x) * (y * -y);
	} else {
		tmp = (x * x) * (y * y);
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if (y <= -4.8e+109) or not (y <= 1.25e+126):
		tmp = (x * x) * (y * -y)
	else:
		tmp = (x * x) * (y * y)
	return tmp
function code(x, y)
	tmp = 0.0
	if ((y <= -4.8e+109) || !(y <= 1.25e+126))
		tmp = Float64(Float64(x * x) * Float64(y * Float64(-y)));
	else
		tmp = Float64(Float64(x * x) * Float64(y * y));
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((y <= -4.8e+109) || ~((y <= 1.25e+126)))
		tmp = (x * x) * (y * -y);
	else
		tmp = (x * x) * (y * y);
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[Or[LessEqual[y, -4.8e+109], N[Not[LessEqual[y, 1.25e+126]], $MachinePrecision]], N[(N[(x * x), $MachinePrecision] * N[(y * (-y)), $MachinePrecision]), $MachinePrecision], N[(N[(x * x), $MachinePrecision] * N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.8 \cdot 10^{+109} \lor \neg \left(y \leq 1.25 \cdot 10^{+126}\right):\\
\;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -4.79999999999999975e109 or 1.24999999999999994e126 < y

    1. Initial program 68.8%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow68.8%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow68.8%

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

        \[\leadsto \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right)} \]
      4. metadata-eval83.8%

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow283.8%

        \[\leadsto \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      6. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow283.8%

        \[\leadsto \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      8. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow283.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      10. metadata-eval83.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow283.8%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr83.8%

      \[\leadsto \color{blue}{\left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - y \cdot y\right)} \]
    4. Taylor expanded in x around 0 90.0%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(-1 \cdot {y}^{2}\right)} \]
    5. Step-by-step derivation
      1. unpow290.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(-1 \cdot \color{blue}{\left(y \cdot y\right)}\right) \]
      2. mul-1-neg90.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(-y \cdot y\right)} \]
      3. distribute-rgt-neg-out90.0%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(y \cdot \left(-y\right)\right)} \]
    6. Simplified90.0%

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

      \[\leadsto \color{blue}{-1 \cdot \left({y}^{2} \cdot {x}^{2}\right)} \]
    8. Step-by-step derivation
      1. mul-1-neg61.7%

        \[\leadsto \color{blue}{-{y}^{2} \cdot {x}^{2}} \]
      2. unpow261.7%

        \[\leadsto -\color{blue}{\left(y \cdot y\right)} \cdot {x}^{2} \]
      3. unpow261.7%

        \[\leadsto -\left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      4. *-commutative61.7%

        \[\leadsto -\color{blue}{\left(x \cdot x\right) \cdot \left(y \cdot y\right)} \]
    9. Simplified61.7%

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

    if -4.79999999999999975e109 < y < 1.24999999999999994e126

    1. Initial program 94.3%

      \[{x}^{4} - {y}^{4} \]
    2. Step-by-step derivation
      1. sqr-pow94.1%

        \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
      2. sqr-pow94.0%

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

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

        \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      5. pow299.7%

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

        \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      7. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
      9. pow299.7%

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

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
      11. pow299.7%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
    3. Applied egg-rr99.7%

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

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{{x}^{2}} \]
    5. Step-by-step derivation
      1. unpow276.5%

        \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    6. Simplified76.5%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    7. Taylor expanded in x around 0 34.5%

      \[\leadsto \color{blue}{{y}^{2} \cdot {x}^{2}} \]
    8. Step-by-step derivation
      1. unpow234.5%

        \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2} \]
      2. unpow234.5%

        \[\leadsto \left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
      3. *-commutative34.5%

        \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(y \cdot y\right)} \]
    9. Simplified34.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -4.8 \cdot 10^{+109} \lor \neg \left(y \leq 1.25 \cdot 10^{+126}\right):\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot \left(-y\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot x\right) \cdot \left(y \cdot y\right)\\ \end{array} \]

Alternative 5: 33.3% accurate, 29.3× speedup?

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

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

    \[{x}^{4} - {y}^{4} \]
  2. Step-by-step derivation
    1. sqr-pow86.2%

      \[\leadsto \color{blue}{{x}^{\left(\frac{4}{2}\right)} \cdot {x}^{\left(\frac{4}{2}\right)}} - {y}^{4} \]
    2. sqr-pow86.1%

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

      \[\leadsto \color{blue}{\left({x}^{\left(\frac{4}{2}\right)} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right)} \]
    4. metadata-eval94.7%

      \[\leadsto \left({x}^{\color{blue}{2}} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    5. pow294.7%

      \[\leadsto \left(\color{blue}{x \cdot x} + {y}^{\left(\frac{4}{2}\right)}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    6. metadata-eval94.7%

      \[\leadsto \left(x \cdot x + {y}^{\color{blue}{2}}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    7. pow294.7%

      \[\leadsto \left(x \cdot x + \color{blue}{y \cdot y}\right) \cdot \left({x}^{\left(\frac{4}{2}\right)} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    8. metadata-eval94.7%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left({x}^{\color{blue}{2}} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    9. pow294.7%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(\color{blue}{x \cdot x} - {y}^{\left(\frac{4}{2}\right)}\right) \]
    10. metadata-eval94.7%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - {y}^{\color{blue}{2}}\right) \]
    11. pow294.7%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \left(x \cdot x - \color{blue}{y \cdot y}\right) \]
  3. Applied egg-rr94.7%

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

    \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{{x}^{2}} \]
  5. Step-by-step derivation
    1. unpow255.8%

      \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
  6. Simplified55.8%

    \[\leadsto \left(x \cdot x + y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
  7. Taylor expanded in x around 0 26.9%

    \[\leadsto \color{blue}{{y}^{2} \cdot {x}^{2}} \]
  8. Step-by-step derivation
    1. unpow226.9%

      \[\leadsto \color{blue}{\left(y \cdot y\right)} \cdot {x}^{2} \]
    2. unpow226.9%

      \[\leadsto \left(y \cdot y\right) \cdot \color{blue}{\left(x \cdot x\right)} \]
    3. *-commutative26.9%

      \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(y \cdot y\right)} \]
  9. Simplified26.9%

    \[\leadsto \color{blue}{\left(x \cdot x\right) \cdot \left(y \cdot y\right)} \]
  10. Final simplification26.9%

    \[\leadsto \left(x \cdot x\right) \cdot \left(y \cdot y\right) \]

Reproduce

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