Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3

Percentage Accurate: 50.4% → 99.9%
Time: 9.2s
Alternatives: 12
Speedup: 3.2×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t_0}{x \cdot x + t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t_0}{x \cdot x + t_0}
\end{array}
\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 12 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: 50.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot 4\right) \cdot y\\ \frac{x \cdot x - t_0}{x \cdot x + t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y 4.0) y))) (/ (- (* x x) t_0) (+ (* x x) t_0))))
double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    t_0 = (y * 4.0d0) * y
    code = ((x * x) - t_0) / ((x * x) + t_0)
end function
public static double code(double x, double y) {
	double t_0 = (y * 4.0) * y;
	return ((x * x) - t_0) / ((x * x) + t_0);
}
def code(x, y):
	t_0 = (y * 4.0) * y
	return ((x * x) - t_0) / ((x * x) + t_0)
function code(x, y)
	t_0 = Float64(Float64(y * 4.0) * y)
	return Float64(Float64(Float64(x * x) - t_0) / Float64(Float64(x * x) + t_0))
end
function tmp = code(x, y)
	t_0 = (y * 4.0) * y;
	tmp = ((x * x) - t_0) / ((x * x) + t_0);
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot 4\right) \cdot y\\
\frac{x \cdot x - t_0}{x \cdot x + t_0}
\end{array}
\end{array}

Alternative 1: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ \frac{\mathsf{fma}\left(y, 2, x\right)}{t_0} \cdot \frac{x - y \cdot 2}{t_0} \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (hypot x (* y 2.0))))
   (* (/ (fma y 2.0 x) t_0) (/ (- x (* y 2.0)) t_0))))
double code(double x, double y) {
	double t_0 = hypot(x, (y * 2.0));
	return (fma(y, 2.0, x) / t_0) * ((x - (y * 2.0)) / t_0);
}
function code(x, y)
	t_0 = hypot(x, Float64(y * 2.0))
	return Float64(Float64(fma(y, 2.0, x) / t_0) * Float64(Float64(x - Float64(y * 2.0)) / t_0))
end
code[x_, y_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\frac{\mathsf{fma}\left(y, 2, x\right)}{t_0} \cdot \frac{x - y \cdot 2}{t_0}
\end{array}
\end{array}
Derivation
  1. Initial program 48.8%

    \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-sqr-sqrt48.8%

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

      \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    3. *-commutative48.8%

      \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. associate-*r*48.8%

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

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

      \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    7. add-sqr-sqrt34.4%

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

      \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    9. *-commutative34.4%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    10. associate-*r*34.4%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    11. sqrt-prod34.4%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    12. sqrt-unprod20.2%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    13. add-sqr-sqrt48.8%

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

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  4. Applied egg-rr48.8%

    \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  5. Step-by-step derivation
    1. add-sqr-sqrt48.8%

      \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
    2. times-frac50.4%

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

      \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    4. fma-def50.4%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    5. add-sqr-sqrt50.4%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. hypot-def50.4%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    7. sqrt-prod21.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    8. *-commutative21.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    9. sqrt-prod21.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    10. metadata-eval21.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    11. associate-*r*21.0%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    12. add-sqr-sqrt50.4%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    13. *-commutative50.4%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
  6. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
  7. Final simplification99.9%

    \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
  8. Add Preprocessing

Alternative 2: 47.0% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ \mathbf{if}\;t_0 \leq 2000:\\ \;\;\;\;\frac{x - y \cdot 2}{t_1} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{t_1}^{2}}{x + y \cdot -2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{t_1} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (hypot x (* y 2.0))))
   (if (<= t_0 2000.0)
     (* (/ (- x (* y 2.0)) t_1) (+ 1.0 (/ (* y 2.0) x)))
     (if (<= t_0 5e+210)
       (/ (fma y 2.0 x) (/ (pow t_1 2.0) (+ x (* y -2.0))))
       (* (/ (fma y 2.0 x) t_1) (+ (* 0.5 (/ x y)) -1.0))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = hypot(x, (y * 2.0));
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = ((x - (y * 2.0)) / t_1) * (1.0 + ((y * 2.0) / x));
	} else if (t_0 <= 5e+210) {
		tmp = fma(y, 2.0, x) / (pow(t_1, 2.0) / (x + (y * -2.0)));
	} else {
		tmp = (fma(y, 2.0, x) / t_1) * ((0.5 * (x / y)) + -1.0);
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = hypot(x, Float64(y * 2.0))
	tmp = 0.0
	if (t_0 <= 2000.0)
		tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) / t_1) * Float64(1.0 + Float64(Float64(y * 2.0) / x)));
	elseif (t_0 <= 5e+210)
		tmp = Float64(fma(y, 2.0, x) / Float64((t_1 ^ 2.0) / Float64(x + Float64(y * -2.0))));
	else
		tmp = Float64(Float64(fma(y, 2.0, x) / t_1) * Float64(Float64(0.5 * Float64(x / y)) + -1.0));
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$0, 2000.0], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+210], N[(N[(y * 2.0 + x), $MachinePrecision] / N[(N[Power[t$95$1, 2.0], $MachinePrecision] / N[(x + N[(y * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\mathbf{if}\;t_0 \leq 2000:\\
\;\;\;\;\frac{x - y \cdot 2}{t_1} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{t_1}^{2}}{x + y \cdot -2}}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{t_1} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e3

    1. Initial program 57.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative57.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*57.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt50.6%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod50.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr57.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt57.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.3%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 48.0%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/48.0%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative48.0%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified48.0%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]

    if 2e3 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e210

    1. Initial program 81.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt81.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares81.6%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative81.6%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*81.6%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt35.2%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod26.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt81.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr81.6%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. associate-/l*82.0%

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

        \[\leadsto \color{blue}{\left(x + y \cdot 2\right) \cdot \frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x - y \cdot 2}}} \]
      3. +-commutative82.0%

        \[\leadsto \color{blue}{\left(y \cdot 2 + x\right)} \cdot \frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x - y \cdot 2}} \]
      4. fma-def82.0%

        \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2, x\right)} \cdot \frac{1}{\frac{x \cdot x + \left(y \cdot 4\right) \cdot y}{x - y \cdot 2}} \]
      5. *-commutative82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{x \cdot x + \color{blue}{y \cdot \left(y \cdot 4\right)}}{x - y \cdot 2}} \]
      6. associate-*r*82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{x \cdot x + \color{blue}{\left(y \cdot y\right) \cdot 4}}{x - y \cdot 2}} \]
      7. metadata-eval82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{x \cdot x + \left(y \cdot y\right) \cdot \color{blue}{\left(2 \cdot 2\right)}}{x - y \cdot 2}} \]
      8. swap-sqr82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{x \cdot x + \color{blue}{\left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}}{x - y \cdot 2}} \]
      9. pow182.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{\color{blue}{{\left(x \cdot x + \left(y \cdot 2\right) \cdot \left(y \cdot 2\right)\right)}^{1}}}{x - y \cdot 2}} \]
      10. metadata-eval82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{{\left(x \cdot x + \left(y \cdot 2\right) \cdot \left(y \cdot 2\right)\right)}^{\color{blue}{\left(\frac{2}{2}\right)}}}{x - y \cdot 2}} \]
      11. sqrt-pow282.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{\color{blue}{{\left(\sqrt{x \cdot x + \left(y \cdot 2\right) \cdot \left(y \cdot 2\right)}\right)}^{2}}}{x - y \cdot 2}} \]
      12. hypot-udef82.0%

        \[\leadsto \mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{{\color{blue}{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}}^{2}}{x - y \cdot 2}} \]
    6. Applied egg-rr82.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(y, 2, x\right) \cdot \frac{1}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x - y \cdot 2}}} \]
    7. Step-by-step derivation
      1. associate-*r/82.0%

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot 1}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x - y \cdot 2}}} \]
      2. *-rgt-identity82.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x - y \cdot 2}} \]
      3. *-commutative82.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x - \color{blue}{2 \cdot y}}} \]
      4. cancel-sign-sub-inv82.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{\color{blue}{x + \left(-2\right) \cdot y}}} \]
      5. metadata-eval82.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x + \color{blue}{-2} \cdot y}} \]
      6. *-commutative82.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x + \color{blue}{y \cdot -2}}} \]
    8. Simplified82.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x + y \cdot -2}}} \]

    if 4.9999999999999998e210 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt15.2%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares15.2%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative15.2%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*15.2%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt7.7%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*7.7%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod7.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr15.2%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac17.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def17.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in x around 0 55.6%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \color{blue}{\left(0.5 \cdot \frac{x}{y} - 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2000:\\ \;\;\;\;\frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\frac{{\left(\mathsf{hypot}\left(x, y \cdot 2\right)\right)}^{2}}{x + y \cdot -2}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 46.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x - y \cdot 2\\ t_2 := \mathsf{hypot}\left(x, y \cdot 2\right)\\ \mathbf{if}\;t_0 \leq 2000:\\ \;\;\;\;\frac{t_1}{t_2} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{t_2} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (- x (* y 2.0))) (t_2 (hypot x (* y 2.0))))
   (if (<= t_0 2000.0)
     (* (/ t_1 t_2) (+ 1.0 (/ (* y 2.0) x)))
     (if (<= t_0 5e+210)
       (/ (* t_1 (+ x (* y 2.0))) (+ t_0 (* x x)))
       (* (/ (fma y 2.0 x) t_2) (+ (* 0.5 (/ x y)) -1.0))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = x - (y * 2.0);
	double t_2 = hypot(x, (y * 2.0));
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = (t_1 / t_2) * (1.0 + ((y * 2.0) / x));
	} else if (t_0 <= 5e+210) {
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (fma(y, 2.0, x) / t_2) * ((0.5 * (x / y)) + -1.0);
	}
	return tmp;
}
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(x - Float64(y * 2.0))
	t_2 = hypot(x, Float64(y * 2.0))
	tmp = 0.0
	if (t_0 <= 2000.0)
		tmp = Float64(Float64(t_1 / t_2) * Float64(1.0 + Float64(Float64(y * 2.0) / x)));
	elseif (t_0 <= 5e+210)
		tmp = Float64(Float64(t_1 * Float64(x + Float64(y * 2.0))) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(fma(y, 2.0, x) / t_2) * Float64(Float64(0.5 * Float64(x / y)) + -1.0));
	end
	return tmp
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[t$95$0, 2000.0], N[(N[(t$95$1 / t$95$2), $MachinePrecision] * N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+210], N[(N[(t$95$1 * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y * 2.0 + x), $MachinePrecision] / t$95$2), $MachinePrecision] * N[(N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x - y \cdot 2\\
t_2 := \mathsf{hypot}\left(x, y \cdot 2\right)\\
\mathbf{if}\;t_0 \leq 2000:\\
\;\;\;\;\frac{t_1}{t_2} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{t_2} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e3

    1. Initial program 57.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative57.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*57.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt50.6%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod50.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr57.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt57.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.3%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 48.0%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/48.0%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative48.0%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified48.0%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]

    if 2e3 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e210

    1. Initial program 81.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt81.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares81.6%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative81.6%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*81.6%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt35.2%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod26.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt81.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr81.6%

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

    if 4.9999999999999998e210 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt15.2%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares15.2%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative15.2%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*15.2%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt7.7%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*7.7%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod7.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr15.2%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac17.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def17.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in x around 0 55.6%

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \color{blue}{\left(0.5 \cdot \frac{x}{y} - 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2000:\\ \;\;\;\;\frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.2% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x - y \cdot 2\\ \mathbf{if}\;t_0 \leq 2000:\\ \;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{t_1}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (- x (* y 2.0))))
   (if (<= t_0 2000.0)
     (+ 1.0 (/ -6.0 (pow (/ x y) 2.0)))
     (if (<= t_0 5e+210)
       (/ (* t_1 (+ x (* y 2.0))) (+ t_0 (* x x)))
       (* (/ t_1 (hypot x (* y 2.0))) (+ 1.0 (* 0.5 (/ x y))))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = x - (y * 2.0);
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = 1.0 + (-6.0 / pow((x / y), 2.0));
	} else if (t_0 <= 5e+210) {
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (t_1 / hypot(x, (y * 2.0))) * (1.0 + (0.5 * (x / y)));
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = x - (y * 2.0);
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = 1.0 + (-6.0 / Math.pow((x / y), 2.0));
	} else if (t_0 <= 5e+210) {
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (t_1 / Math.hypot(x, (y * 2.0))) * (1.0 + (0.5 * (x / y)));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = x - (y * 2.0)
	tmp = 0
	if t_0 <= 2000.0:
		tmp = 1.0 + (-6.0 / math.pow((x / y), 2.0))
	elif t_0 <= 5e+210:
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x))
	else:
		tmp = (t_1 / math.hypot(x, (y * 2.0))) * (1.0 + (0.5 * (x / y)))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(x - Float64(y * 2.0))
	tmp = 0.0
	if (t_0 <= 2000.0)
		tmp = Float64(1.0 + Float64(-6.0 / (Float64(x / y) ^ 2.0)));
	elseif (t_0 <= 5e+210)
		tmp = Float64(Float64(t_1 * Float64(x + Float64(y * 2.0))) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(t_1 / hypot(x, Float64(y * 2.0))) * Float64(1.0 + Float64(0.5 * Float64(x / y))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = x - (y * 2.0);
	tmp = 0.0;
	if (t_0 <= 2000.0)
		tmp = 1.0 + (-6.0 / ((x / y) ^ 2.0));
	elseif (t_0 <= 5e+210)
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	else
		tmp = (t_1 / hypot(x, (y * 2.0))) * (1.0 + (0.5 * (x / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2000.0], N[(1.0 + N[(-6.0 / N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+210], N[(N[(t$95$1 * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x - y \cdot 2\\
\mathbf{if}\;t_0 \leq 2000:\\
\;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\frac{t_1}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e3

    1. Initial program 57.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative57.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*57.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt50.6%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod50.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr57.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt57.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.3%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 48.0%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/48.0%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative48.0%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified48.0%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Taylor expanded in y around 0 77.0%

      \[\leadsto \color{blue}{1 + -6 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    11. Step-by-step derivation
      1. associate-*r/77.0%

        \[\leadsto 1 + \color{blue}{\frac{-6 \cdot {y}^{2}}{{x}^{2}}} \]
      2. associate-/l*77.0%

        \[\leadsto 1 + \color{blue}{\frac{-6}{\frac{{x}^{2}}{{y}^{2}}}} \]
      3. unpow277.0%

        \[\leadsto 1 + \frac{-6}{\frac{\color{blue}{x \cdot x}}{{y}^{2}}} \]
      4. unpow277.0%

        \[\leadsto 1 + \frac{-6}{\frac{x \cdot x}{\color{blue}{y \cdot y}}} \]
      5. times-frac83.0%

        \[\leadsto 1 + \frac{-6}{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} \]
      6. unpow283.0%

        \[\leadsto 1 + \frac{-6}{\color{blue}{{\left(\frac{x}{y}\right)}^{2}}} \]
    12. Simplified83.0%

      \[\leadsto \color{blue}{1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}} \]

    if 2e3 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e210

    1. Initial program 81.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt81.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares81.6%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative81.6%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*81.6%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt35.2%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod26.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt81.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr81.6%

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

    if 4.9999999999999998e210 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt15.2%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares15.2%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative15.2%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*15.2%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt7.7%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*7.7%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod7.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr15.2%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac17.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def17.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 55.6%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification74.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2000:\\ \;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 46.9% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := x - y \cdot 2\\ t_2 := \frac{t_1}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\ \mathbf{if}\;t_0 \leq 2000:\\ \;\;\;\;t_2 \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;t_2 \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0)))
        (t_1 (- x (* y 2.0)))
        (t_2 (/ t_1 (hypot x (* y 2.0)))))
   (if (<= t_0 2000.0)
     (* t_2 (+ 1.0 (/ (* y 2.0) x)))
     (if (<= t_0 5e+210)
       (/ (* t_1 (+ x (* y 2.0))) (+ t_0 (* x x)))
       (* t_2 (+ 1.0 (* 0.5 (/ x y))))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = x - (y * 2.0);
	double t_2 = t_1 / hypot(x, (y * 2.0));
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = t_2 * (1.0 + ((y * 2.0) / x));
	} else if (t_0 <= 5e+210) {
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = t_2 * (1.0 + (0.5 * (x / y)));
	}
	return tmp;
}
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = x - (y * 2.0);
	double t_2 = t_1 / Math.hypot(x, (y * 2.0));
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = t_2 * (1.0 + ((y * 2.0) / x));
	} else if (t_0 <= 5e+210) {
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = t_2 * (1.0 + (0.5 * (x / y)));
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = x - (y * 2.0)
	t_2 = t_1 / math.hypot(x, (y * 2.0))
	tmp = 0
	if t_0 <= 2000.0:
		tmp = t_2 * (1.0 + ((y * 2.0) / x))
	elif t_0 <= 5e+210:
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x))
	else:
		tmp = t_2 * (1.0 + (0.5 * (x / y)))
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(x - Float64(y * 2.0))
	t_2 = Float64(t_1 / hypot(x, Float64(y * 2.0)))
	tmp = 0.0
	if (t_0 <= 2000.0)
		tmp = Float64(t_2 * Float64(1.0 + Float64(Float64(y * 2.0) / x)));
	elseif (t_0 <= 5e+210)
		tmp = Float64(Float64(t_1 * Float64(x + Float64(y * 2.0))) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(t_2 * Float64(1.0 + Float64(0.5 * Float64(x / y))));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = x - (y * 2.0);
	t_2 = t_1 / hypot(x, (y * 2.0));
	tmp = 0.0;
	if (t_0 <= 2000.0)
		tmp = t_2 * (1.0 + ((y * 2.0) / x));
	elseif (t_0 <= 5e+210)
		tmp = (t_1 * (x + (y * 2.0))) / (t_0 + (x * x));
	else
		tmp = t_2 * (1.0 + (0.5 * (x / y)));
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[Sqrt[x ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2000.0], N[(t$95$2 * N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+210], N[(N[(t$95$1 * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(1.0 + N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := x - y \cdot 2\\
t_2 := \frac{t_1}{\mathsf{hypot}\left(x, y \cdot 2\right)}\\
\mathbf{if}\;t_0 \leq 2000:\\
\;\;\;\;t_2 \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\
\;\;\;\;\frac{t_1 \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e3

    1. Initial program 57.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative57.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*57.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt50.6%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod50.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr57.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt57.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.3%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 48.0%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/48.0%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative48.0%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified48.0%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]

    if 2e3 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e210

    1. Initial program 81.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt81.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares81.6%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative81.6%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*81.6%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt35.2%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod26.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt81.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr81.6%

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

    if 4.9999999999999998e210 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt15.2%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares15.2%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative15.2%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*15.2%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt7.7%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*7.7%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod7.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr15.2%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac17.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def17.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 55.6%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2000:\\ \;\;\;\;\frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + \frac{y \cdot 2}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 77.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := 0.5 \cdot \frac{x}{y}\\ \mathbf{if}\;t_0 \leq 2000:\\ \;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + -1\right) \cdot \left(1 + t_1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (* 0.5 (/ x y))))
   (if (<= t_0 2000.0)
     (+ 1.0 (/ -6.0 (pow (/ x y) 2.0)))
     (if (<= t_0 5e+210)
       (/ (* (- x (* y 2.0)) (+ x (* y 2.0))) (+ t_0 (* x x)))
       (* (+ t_1 -1.0) (+ 1.0 t_1))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = 0.5 * (x / y);
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = 1.0 + (-6.0 / pow((x / y), 2.0));
	} else if (t_0 <= 5e+210) {
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (t_1 + -1.0) * (1.0 + 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 = y * (y * 4.0d0)
    t_1 = 0.5d0 * (x / y)
    if (t_0 <= 2000.0d0) then
        tmp = 1.0d0 + ((-6.0d0) / ((x / y) ** 2.0d0))
    else if (t_0 <= 5d+210) then
        tmp = ((x - (y * 2.0d0)) * (x + (y * 2.0d0))) / (t_0 + (x * x))
    else
        tmp = (t_1 + (-1.0d0)) * (1.0d0 + t_1)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = 0.5 * (x / y);
	double tmp;
	if (t_0 <= 2000.0) {
		tmp = 1.0 + (-6.0 / Math.pow((x / y), 2.0));
	} else if (t_0 <= 5e+210) {
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (t_1 + -1.0) * (1.0 + t_1);
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = 0.5 * (x / y)
	tmp = 0
	if t_0 <= 2000.0:
		tmp = 1.0 + (-6.0 / math.pow((x / y), 2.0))
	elif t_0 <= 5e+210:
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / (t_0 + (x * x))
	else:
		tmp = (t_1 + -1.0) * (1.0 + t_1)
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(0.5 * Float64(x / y))
	tmp = 0.0
	if (t_0 <= 2000.0)
		tmp = Float64(1.0 + Float64(-6.0 / (Float64(x / y) ^ 2.0)));
	elseif (t_0 <= 5e+210)
		tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) * Float64(x + Float64(y * 2.0))) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(t_1 + -1.0) * Float64(1.0 + t_1));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = 0.5 * (x / y);
	tmp = 0.0;
	if (t_0 <= 2000.0)
		tmp = 1.0 + (-6.0 / ((x / y) ^ 2.0));
	elseif (t_0 <= 5e+210)
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / (t_0 + (x * x));
	else
		tmp = (t_1 + -1.0) * (1.0 + t_1);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2000.0], N[(1.0 + N[(-6.0 / N[Power[N[(x / y), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+210], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + -1.0), $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x}{y}\\
\mathbf{if}\;t_0 \leq 2000:\\
\;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\

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

\mathbf{else}:\\
\;\;\;\;\left(t_1 + -1\right) \cdot \left(1 + t_1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 2e3

    1. Initial program 57.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative57.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*57.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt50.6%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*50.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod50.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt57.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr57.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt57.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.3%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.3%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*26.2%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 48.0%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/48.0%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative48.0%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified48.0%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Taylor expanded in y around 0 77.0%

      \[\leadsto \color{blue}{1 + -6 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    11. Step-by-step derivation
      1. associate-*r/77.0%

        \[\leadsto 1 + \color{blue}{\frac{-6 \cdot {y}^{2}}{{x}^{2}}} \]
      2. associate-/l*77.0%

        \[\leadsto 1 + \color{blue}{\frac{-6}{\frac{{x}^{2}}{{y}^{2}}}} \]
      3. unpow277.0%

        \[\leadsto 1 + \frac{-6}{\frac{\color{blue}{x \cdot x}}{{y}^{2}}} \]
      4. unpow277.0%

        \[\leadsto 1 + \frac{-6}{\frac{x \cdot x}{\color{blue}{y \cdot y}}} \]
      5. times-frac83.0%

        \[\leadsto 1 + \frac{-6}{\color{blue}{\frac{x}{y} \cdot \frac{x}{y}}} \]
      6. unpow283.0%

        \[\leadsto 1 + \frac{-6}{\color{blue}{{\left(\frac{x}{y}\right)}^{2}}} \]
    12. Simplified83.0%

      \[\leadsto \color{blue}{1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}} \]

    if 2e3 < (*.f64 (*.f64 y 4) y) < 4.9999999999999998e210

    1. Initial program 81.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt81.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares81.6%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative81.6%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*81.6%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt35.2%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod35.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod26.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt81.6%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr81.6%

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

    if 4.9999999999999998e210 < (*.f64 (*.f64 y 4) y)

    1. Initial program 15.2%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt15.2%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares15.2%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative15.2%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*15.2%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt7.7%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*7.7%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod7.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval15.2%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr15.2%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac17.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def17.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*9.3%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative17.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 55.6%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Taylor expanded in x around 0 88.8%

      \[\leadsto \left(1 + 0.5 \cdot \frac{x}{y}\right) \cdot \color{blue}{\left(0.5 \cdot \frac{x}{y} - 1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification84.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 2000:\\ \;\;\;\;1 + \frac{-6}{{\left(\frac{x}{y}\right)}^{2}}\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{+210}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \frac{x}{y} + -1\right) \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 64.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq 19:\\ \;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{+109}:\\ \;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x y))))
   (if (<= y 19.0)
     (* (+ 1.0 (/ (* y 2.0) x)) (+ 1.0 (/ (* y -2.0) x)))
     (if (<= y 5.7e+109)
       (/ (* (- x (* y 2.0)) (+ x (* y 2.0))) (+ (* y (* y 4.0)) (* x x)))
       (* (+ t_0 -1.0) (+ 1.0 t_0))))))
double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 19.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else if (y <= 5.7e+109) {
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((y * (y * 4.0)) + (x * x));
	} else {
		tmp = (t_0 + -1.0) * (1.0 + 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.5d0 * (x / y)
    if (y <= 19.0d0) then
        tmp = (1.0d0 + ((y * 2.0d0) / x)) * (1.0d0 + ((y * (-2.0d0)) / x))
    else if (y <= 5.7d+109) then
        tmp = ((x - (y * 2.0d0)) * (x + (y * 2.0d0))) / ((y * (y * 4.0d0)) + (x * x))
    else
        tmp = (t_0 + (-1.0d0)) * (1.0d0 + t_0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 19.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else if (y <= 5.7e+109) {
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((y * (y * 4.0)) + (x * x));
	} else {
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.5 * (x / y)
	tmp = 0
	if y <= 19.0:
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x))
	elif y <= 5.7e+109:
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((y * (y * 4.0)) + (x * x))
	else:
		tmp = (t_0 + -1.0) * (1.0 + t_0)
	return tmp
function code(x, y)
	t_0 = Float64(0.5 * Float64(x / y))
	tmp = 0.0
	if (y <= 19.0)
		tmp = Float64(Float64(1.0 + Float64(Float64(y * 2.0) / x)) * Float64(1.0 + Float64(Float64(y * -2.0) / x)));
	elseif (y <= 5.7e+109)
		tmp = Float64(Float64(Float64(x - Float64(y * 2.0)) * Float64(x + Float64(y * 2.0))) / Float64(Float64(y * Float64(y * 4.0)) + Float64(x * x)));
	else
		tmp = Float64(Float64(t_0 + -1.0) * Float64(1.0 + t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.5 * (x / y);
	tmp = 0.0;
	if (y <= 19.0)
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	elseif (y <= 5.7e+109)
		tmp = ((x - (y * 2.0)) * (x + (y * 2.0))) / ((y * (y * 4.0)) + (x * x));
	else
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 19.0], N[(N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.7e+109], N[(N[(N[(x - N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision] + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + -1.0), $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq 19:\\
\;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\

\mathbf{elif}\;y \leq 5.7 \cdot 10^{+109}:\\
\;\;\;\;\frac{\left(x - y \cdot 2\right) \cdot \left(x + y \cdot 2\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\


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

    1. Initial program 56.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt56.7%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative56.7%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*56.7%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt36.9%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval36.9%

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod17.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt56.7%

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

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt56.7%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.0%

        \[\leadsto \color{blue}{\frac{x + y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      3. +-commutative58.0%

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 35.9%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/35.9%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative35.9%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified35.9%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Taylor expanded in x around inf 62.7%

      \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \color{blue}{\left(1 + -2 \cdot \frac{y}{x}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \color{blue}{\frac{-2 \cdot y}{x}}\right) \]
      2. *-commutative62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{\color{blue}{y \cdot -2}}{x}\right) \]
    12. Simplified62.7%

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

    if 19 < y < 5.7000000000000002e109

    1. Initial program 68.4%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt68.4%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares68.4%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative68.4%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*68.4%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      5. sqrt-prod68.4%

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt68.4%

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

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative68.4%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*68.4%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod68.4%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod67.8%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt68.4%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval68.4%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr68.4%

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

    if 5.7000000000000002e109 < y

    1. Initial program 12.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt12.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative12.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*12.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt12.0%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod11.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt12.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr12.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac14.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def14.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 86.9%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Taylor expanded in x around 0 86.7%

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

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

Alternative 8: 64.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ t_1 := 0.5 \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq 115:\\ \;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{+109}:\\ \;\;\;\;\frac{x \cdot x - t_0}{t_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(t_1 + -1\right) \cdot \left(1 + t_1\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))) (t_1 (* 0.5 (/ x y))))
   (if (<= y 115.0)
     (* (+ 1.0 (/ (* y 2.0) x)) (+ 1.0 (/ (* y -2.0) x)))
     (if (<= y 5.7e+109)
       (/ (- (* x x) t_0) (+ t_0 (* x x)))
       (* (+ t_1 -1.0) (+ 1.0 t_1))))))
double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = 0.5 * (x / y);
	double tmp;
	if (y <= 115.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else if (y <= 5.7e+109) {
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	} else {
		tmp = (t_1 + -1.0) * (1.0 + 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 = y * (y * 4.0d0)
    t_1 = 0.5d0 * (x / y)
    if (y <= 115.0d0) then
        tmp = (1.0d0 + ((y * 2.0d0) / x)) * (1.0d0 + ((y * (-2.0d0)) / x))
    else if (y <= 5.7d+109) then
        tmp = ((x * x) - t_0) / (t_0 + (x * x))
    else
        tmp = (t_1 + (-1.0d0)) * (1.0d0 + t_1)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = y * (y * 4.0);
	double t_1 = 0.5 * (x / y);
	double tmp;
	if (y <= 115.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else if (y <= 5.7e+109) {
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	} else {
		tmp = (t_1 + -1.0) * (1.0 + t_1);
	}
	return tmp;
}
def code(x, y):
	t_0 = y * (y * 4.0)
	t_1 = 0.5 * (x / y)
	tmp = 0
	if y <= 115.0:
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x))
	elif y <= 5.7e+109:
		tmp = ((x * x) - t_0) / (t_0 + (x * x))
	else:
		tmp = (t_1 + -1.0) * (1.0 + t_1)
	return tmp
function code(x, y)
	t_0 = Float64(y * Float64(y * 4.0))
	t_1 = Float64(0.5 * Float64(x / y))
	tmp = 0.0
	if (y <= 115.0)
		tmp = Float64(Float64(1.0 + Float64(Float64(y * 2.0) / x)) * Float64(1.0 + Float64(Float64(y * -2.0) / x)));
	elseif (y <= 5.7e+109)
		tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(t_1 + -1.0) * Float64(1.0 + t_1));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = y * (y * 4.0);
	t_1 = 0.5 * (x / y);
	tmp = 0.0;
	if (y <= 115.0)
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	elseif (y <= 5.7e+109)
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	else
		tmp = (t_1 + -1.0) * (1.0 + t_1);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 115.0], N[(N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.7e+109], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 + -1.0), $MachinePrecision] * N[(1.0 + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq 115:\\
\;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\

\mathbf{elif}\;y \leq 5.7 \cdot 10^{+109}:\\
\;\;\;\;\frac{x \cdot x - t_0}{t_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\left(t_1 + -1\right) \cdot \left(1 + t_1\right)\\


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

    1. Initial program 56.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt56.7%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative56.7%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*56.7%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt36.9%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval36.9%

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod17.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt56.7%

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

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt56.7%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.0%

        \[\leadsto \color{blue}{\frac{x + y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      3. +-commutative58.0%

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 35.9%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/35.9%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative35.9%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified35.9%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Taylor expanded in x around inf 62.7%

      \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \color{blue}{\left(1 + -2 \cdot \frac{y}{x}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \color{blue}{\frac{-2 \cdot y}{x}}\right) \]
      2. *-commutative62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{\color{blue}{y \cdot -2}}{x}\right) \]
    12. Simplified62.7%

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

    if 115 < y < 5.7000000000000002e109

    1. Initial program 68.4%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing

    if 5.7000000000000002e109 < y

    1. Initial program 12.0%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt12.0%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative12.0%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*12.0%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt12.0%

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod11.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt12.0%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr12.0%

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt12.0%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac14.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def14.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*14.7%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative14.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 86.9%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Taylor expanded in x around 0 86.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 115:\\ \;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\ \mathbf{elif}\;y \leq 5.7 \cdot 10^{+109}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \frac{x}{y} + -1\right) \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 62.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq 3600:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x y))))
   (if (<= y 3600.0) 1.0 (* (+ t_0 -1.0) (+ 1.0 t_0)))))
double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 3600.0) {
		tmp = 1.0;
	} else {
		tmp = (t_0 + -1.0) * (1.0 + 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.5d0 * (x / y)
    if (y <= 3600.0d0) then
        tmp = 1.0d0
    else
        tmp = (t_0 + (-1.0d0)) * (1.0d0 + t_0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 3600.0) {
		tmp = 1.0;
	} else {
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.5 * (x / y)
	tmp = 0
	if y <= 3600.0:
		tmp = 1.0
	else:
		tmp = (t_0 + -1.0) * (1.0 + t_0)
	return tmp
function code(x, y)
	t_0 = Float64(0.5 * Float64(x / y))
	tmp = 0.0
	if (y <= 3600.0)
		tmp = 1.0;
	else
		tmp = Float64(Float64(t_0 + -1.0) * Float64(1.0 + t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.5 * (x / y);
	tmp = 0.0;
	if (y <= 3600.0)
		tmp = 1.0;
	else
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 3600.0], 1.0, N[(N[(t$95$0 + -1.0), $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq 3600:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\


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

    1. Initial program 56.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 61.5%

      \[\leadsto \color{blue}{1} \]

    if 3600 < y

    1. Initial program 27.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt27.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares27.5%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative27.5%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*27.5%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      5. sqrt-prod27.5%

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt27.5%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval27.5%

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod27.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr27.5%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac29.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def29.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 80.9%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Taylor expanded in x around 0 80.6%

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

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

Alternative 10: 63.6% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{y}\\ \mathbf{if}\;y \leq 27000:\\ \;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x y))))
   (if (<= y 27000.0)
     (* (+ 1.0 (/ (* y 2.0) x)) (+ 1.0 (/ (* y -2.0) x)))
     (* (+ t_0 -1.0) (+ 1.0 t_0)))))
double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 27000.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else {
		tmp = (t_0 + -1.0) * (1.0 + 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.5d0 * (x / y)
    if (y <= 27000.0d0) then
        tmp = (1.0d0 + ((y * 2.0d0) / x)) * (1.0d0 + ((y * (-2.0d0)) / x))
    else
        tmp = (t_0 + (-1.0d0)) * (1.0d0 + t_0)
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = 0.5 * (x / y);
	double tmp;
	if (y <= 27000.0) {
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	} else {
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	}
	return tmp;
}
def code(x, y):
	t_0 = 0.5 * (x / y)
	tmp = 0
	if y <= 27000.0:
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x))
	else:
		tmp = (t_0 + -1.0) * (1.0 + t_0)
	return tmp
function code(x, y)
	t_0 = Float64(0.5 * Float64(x / y))
	tmp = 0.0
	if (y <= 27000.0)
		tmp = Float64(Float64(1.0 + Float64(Float64(y * 2.0) / x)) * Float64(1.0 + Float64(Float64(y * -2.0) / x)));
	else
		tmp = Float64(Float64(t_0 + -1.0) * Float64(1.0 + t_0));
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = 0.5 * (x / y);
	tmp = 0.0;
	if (y <= 27000.0)
		tmp = (1.0 + ((y * 2.0) / x)) * (1.0 + ((y * -2.0) / x));
	else
		tmp = (t_0 + -1.0) * (1.0 + t_0);
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(0.5 * N[(x / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 27000.0], N[(N[(1.0 + N[(N[(y * 2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(N[(y * -2.0), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 + -1.0), $MachinePrecision] * N[(1.0 + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{y}\\
\mathbf{if}\;y \leq 27000:\\
\;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(t_0 + -1\right) \cdot \left(1 + t_0\right)\\


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

    1. Initial program 56.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt56.7%

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

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative56.7%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*56.7%

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

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt36.9%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval36.9%

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod36.9%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod17.6%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt56.7%

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

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

      \[\leadsto \frac{\color{blue}{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    5. Step-by-step derivation
      1. add-sqr-sqrt56.7%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac58.0%

        \[\leadsto \color{blue}{\frac{x + y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      3. +-commutative58.0%

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def58.0%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*17.9%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative58.0%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around 0 35.9%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Step-by-step derivation
      1. associate-*r/35.9%

        \[\leadsto \left(1 + \color{blue}{\frac{2 \cdot y}{x}}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      2. *-commutative35.9%

        \[\leadsto \left(1 + \frac{\color{blue}{y \cdot 2}}{x}\right) \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    9. Simplified35.9%

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot 2}{x}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    10. Taylor expanded in x around inf 62.7%

      \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \color{blue}{\left(1 + -2 \cdot \frac{y}{x}\right)} \]
    11. Step-by-step derivation
      1. associate-*r/62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \color{blue}{\frac{-2 \cdot y}{x}}\right) \]
      2. *-commutative62.7%

        \[\leadsto \left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{\color{blue}{y \cdot -2}}{x}\right) \]
    12. Simplified62.7%

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

    if 27000 < y

    1. Initial program 27.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-sqr-sqrt27.5%

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares27.5%

        \[\leadsto \frac{\color{blue}{\left(x + \sqrt{\left(y \cdot 4\right) \cdot y}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      3. *-commutative27.5%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      4. associate-*r*27.5%

        \[\leadsto \frac{\left(x + \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      5. sqrt-prod27.5%

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      7. add-sqr-sqrt27.5%

        \[\leadsto \frac{\left(x + \color{blue}{y} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      8. metadata-eval27.5%

        \[\leadsto \frac{\left(x + y \cdot \color{blue}{2}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      9. *-commutative27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{y \cdot \left(y \cdot 4\right)}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      10. associate-*r*27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \sqrt{\color{blue}{\left(y \cdot y\right) \cdot 4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      11. sqrt-prod27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod27.3%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      13. add-sqr-sqrt27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{y} \cdot \sqrt{4}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      14. metadata-eval27.5%

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot \color{blue}{2}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    4. Applied egg-rr27.5%

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - y \cdot 2\right)}{\color{blue}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y} \cdot \sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}}} \]
      2. times-frac29.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      4. fma-def29.8%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(y, 2, x\right)}}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      5. add-sqr-sqrt29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\sqrt{x \cdot x + \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      6. hypot-def29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\color{blue}{\mathsf{hypot}\left(x, \sqrt{\left(y \cdot 4\right) \cdot y}\right)}} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      7. sqrt-prod29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\sqrt{y \cdot 4} \cdot \sqrt{y}}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      8. *-commutative29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \sqrt{\color{blue}{4 \cdot y}} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      9. sqrt-prod29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{\left(\sqrt{4} \cdot \sqrt{y}\right)} \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      10. metadata-eval29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \left(\color{blue}{2} \cdot \sqrt{y}\right) \cdot \sqrt{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      11. associate-*r*29.5%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{2 \cdot \left(\sqrt{y} \cdot \sqrt{y}\right)}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      12. add-sqr-sqrt29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, 2 \cdot \color{blue}{y}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
      13. *-commutative29.8%

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, \color{blue}{y \cdot 2}\right)} \cdot \frac{x - y \cdot 2}{\sqrt{x \cdot x + \left(y \cdot 4\right) \cdot y}} \]
    6. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
    7. Taylor expanded in y around inf 80.9%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{x - y \cdot 2}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    8. Taylor expanded in x around 0 80.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 27000:\\ \;\;\;\;\left(1 + \frac{y \cdot 2}{x}\right) \cdot \left(1 + \frac{y \cdot -2}{x}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \frac{x}{y} + -1\right) \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 62.5% accurate, 3.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y \leq 21000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
(FPCore (x y) :precision binary64 (if (<= y 21000.0) 1.0 -1.0))
double code(double x, double y) {
	double tmp;
	if (y <= 21000.0) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 21000.0d0) then
        tmp = 1.0d0
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (y <= 21000.0) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if y <= 21000.0:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (y <= 21000.0)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 21000.0)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[y, 21000.0], 1.0, -1.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y \leq 21000:\\
\;\;\;\;1\\

\mathbf{else}:\\
\;\;\;\;-1\\


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

    1. Initial program 56.7%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 61.5%

      \[\leadsto \color{blue}{1} \]

    if 21000 < y

    1. Initial program 27.5%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0 80.0%

      \[\leadsto \color{blue}{-1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 21000:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 50.3% accurate, 19.0× speedup?

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

\\
-1
\end{array}
Derivation
  1. Initial program 48.8%

    \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  2. Add Preprocessing
  3. Taylor expanded in x around 0 49.5%

    \[\leadsto \color{blue}{-1} \]
  4. Final simplification49.5%

    \[\leadsto -1 \]
  5. Add Preprocessing

Developer target: 50.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot y\right) \cdot 4\\ t_1 := x \cdot x + t_0\\ t_2 := \frac{t_0}{t_1}\\ t_3 := \left(y \cdot 4\right) \cdot y\\ \mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\ \;\;\;\;\frac{x \cdot x}{t_1} - t_2\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y y) 4.0))
        (t_1 (+ (* x x) t_0))
        (t_2 (/ t_0 t_1))
        (t_3 (* (* y 4.0) y)))
   (if (< (/ (- (* x x) t_3) (+ (* x x) t_3)) 0.9743233849626781)
     (- (/ (* x x) t_1) t_2)
     (- (pow (/ x (sqrt t_1)) 2.0) t_2))))
double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = pow((x / sqrt(t_1)), 2.0) - t_2;
	}
	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) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = (y * y) * 4.0d0
    t_1 = (x * x) + t_0
    t_2 = t_0 / t_1
    t_3 = (y * 4.0d0) * y
    if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781d0) then
        tmp = ((x * x) / t_1) - t_2
    else
        tmp = ((x / sqrt(t_1)) ** 2.0d0) - t_2
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = Math.pow((x / Math.sqrt(t_1)), 2.0) - t_2;
	}
	return tmp;
}
def code(x, y):
	t_0 = (y * y) * 4.0
	t_1 = (x * x) + t_0
	t_2 = t_0 / t_1
	t_3 = (y * 4.0) * y
	tmp = 0
	if (((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781:
		tmp = ((x * x) / t_1) - t_2
	else:
		tmp = math.pow((x / math.sqrt(t_1)), 2.0) - t_2
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y * y) * 4.0)
	t_1 = Float64(Float64(x * x) + t_0)
	t_2 = Float64(t_0 / t_1)
	t_3 = Float64(Float64(y * 4.0) * y)
	tmp = 0.0
	if (Float64(Float64(Float64(x * x) - t_3) / Float64(Float64(x * x) + t_3)) < 0.9743233849626781)
		tmp = Float64(Float64(Float64(x * x) / t_1) - t_2);
	else
		tmp = Float64((Float64(x / sqrt(t_1)) ^ 2.0) - t_2);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y * y) * 4.0;
	t_1 = (x * x) + t_0;
	t_2 = t_0 / t_1;
	t_3 = (y * 4.0) * y;
	tmp = 0.0;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781)
		tmp = ((x * x) / t_1) - t_2;
	else
		tmp = ((x / sqrt(t_1)) ^ 2.0) - t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[Less[N[(N[(N[(x * x), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], 0.9743233849626781], N[(N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[Power[N[(x / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot 4\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{t_0}{t_1}\\
t_3 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\
\;\;\;\;\frac{x \cdot x}{t_1} - t_2\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024018 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))

  (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))