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

Percentage Accurate: 50.7% → 99.9%
Time: 9.9s
Alternatives: 11
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 11 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 50.7% 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} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x, y\_m \cdot 2\right)\\ \frac{\frac{\mathsf{fma}\left(y\_m, -2, x\right)}{t\_0}}{\frac{t\_0}{x + y\_m \cdot 2}} \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (hypot x (* y_m 2.0))))
   (/ (/ (fma y_m -2.0 x) t_0) (/ t_0 (+ x (* y_m 2.0))))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = hypot(x, (y_m * 2.0));
	return (fma(y_m, -2.0, x) / t_0) / (t_0 / (x + (y_m * 2.0)));
}
y_m = abs(y)
function code(x, y_m)
	t_0 = hypot(x, Float64(y_m * 2.0))
	return Float64(Float64(fma(y_m, -2.0, x) / t_0) / Float64(t_0 / Float64(x + Float64(y_m * 2.0))))
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[Sqrt[x ^ 2 + N[(y$95$m * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y$95$m * -2.0 + x), $MachinePrecision] / t$95$0), $MachinePrecision] / N[(t$95$0 / N[(x + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(x, y\_m \cdot 2\right)\\
\frac{\frac{\mathsf{fma}\left(y\_m, -2, x\right)}{t\_0}}{\frac{t\_0}{x + y\_m \cdot 2}}
\end{array}
\end{array}
Derivation
  1. Initial program 51.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-sqrt51.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-squares51.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. *-commutative51.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*51.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-prod51.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-unprod28.0%

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

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

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

      \[\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*39.1%

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

      \[\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-unprod28.0%

      \[\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-sqrt51.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-eval51.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-rr51.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-sqrt51.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-frac52.7%

      \[\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. +-commutative52.7%

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

      \[\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. +-commutative52.7%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
  7. Step-by-step derivation
    1. *-commutative99.9%

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

      \[\leadsto \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \cdot \color{blue}{\frac{1}{\frac{\mathsf{hypot}\left(y \cdot 2, x\right)}{\mathsf{fma}\left(y, 2, x\right)}}} \]
    3. un-div-inv100.0%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}{\frac{\mathsf{hypot}\left(x, y \cdot 2\right)}{\mathsf{fma}\left(y, 2, x\right)}}} \]
  9. Step-by-step derivation
    1. fma-undefine100.0%

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

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

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

Alternative 2: 99.9% accurate, 0.1× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(y\_m \cdot 2, x\right)\\ \frac{x + y\_m \cdot 2}{t\_0} \cdot \frac{x + y\_m \cdot -2}{t\_0} \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (hypot (* y_m 2.0) x)))
   (* (/ (+ x (* y_m 2.0)) t_0) (/ (+ x (* y_m -2.0)) t_0))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = hypot((y_m * 2.0), x);
	return ((x + (y_m * 2.0)) / t_0) * ((x + (y_m * -2.0)) / t_0);
}
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = Math.hypot((y_m * 2.0), x);
	return ((x + (y_m * 2.0)) / t_0) * ((x + (y_m * -2.0)) / t_0);
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = math.hypot((y_m * 2.0), x)
	return ((x + (y_m * 2.0)) / t_0) * ((x + (y_m * -2.0)) / t_0)
y_m = abs(y)
function code(x, y_m)
	t_0 = hypot(Float64(y_m * 2.0), x)
	return Float64(Float64(Float64(x + Float64(y_m * 2.0)) / t_0) * Float64(Float64(x + Float64(y_m * -2.0)) / t_0))
end
y_m = abs(y);
function tmp = code(x, y_m)
	t_0 = hypot((y_m * 2.0), x);
	tmp = ((x + (y_m * 2.0)) / t_0) * ((x + (y_m * -2.0)) / t_0);
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[Sqrt[N[(y$95$m * 2.0), $MachinePrecision] ^ 2 + x ^ 2], $MachinePrecision]}, N[(N[(N[(x + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(x + N[(y$95$m * -2.0), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(y\_m \cdot 2, x\right)\\
\frac{x + y\_m \cdot 2}{t\_0} \cdot \frac{x + y\_m \cdot -2}{t\_0}
\end{array}
\end{array}
Derivation
  1. Initial program 51.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-sqrt51.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-squares51.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. *-commutative51.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*51.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-prod51.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-unprod28.0%

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

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

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

      \[\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*39.1%

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

      \[\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-unprod28.0%

      \[\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-sqrt51.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-eval51.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-rr51.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-sqrt51.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-frac52.7%

      \[\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. +-commutative52.7%

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

      \[\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. +-commutative52.7%

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
  7. Step-by-step derivation
    1. fma-undefine100.0%

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

    \[\leadsto \frac{\color{blue}{y \cdot 2 + x}}{\mathsf{hypot}\left(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \]
  9. Step-by-step derivation
    1. fma-undefine99.9%

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

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

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

Alternative 3: 65.7% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := x + y\_m \cdot 2\\
t_2 := \mathsf{hypot}\left(y\_m \cdot 2, x\right)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\
\;\;\;\;\frac{t\_1}{t\_2} \cdot \left(1 + -2 \cdot \frac{y\_m}{x}\right)\\

\mathbf{elif}\;t\_0 \leq 10^{+270}:\\
\;\;\;\;\frac{t\_1 \cdot \left(x - y\_m \cdot 2\right)}{t\_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x + y\_m \cdot -2}{t\_2} \cdot \left(1 + 0.5 \cdot \frac{x}{y\_m}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 5.0000000000000002e-157

    1. Initial program 53.9%

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

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

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

        \[\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*53.9%

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

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

        \[\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-sqrt49.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-eval49.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. *-commutative49.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*49.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-prod49.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-unprod28.1%

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

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

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

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

        \[\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-frac55.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. +-commutative55.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-define55.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. +-commutative55.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Step-by-step derivation
      1. fma-undefine100.0%

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

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

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

    if 5.0000000000000002e-157 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 1e270

    1. Initial program 80.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-sqrt80.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-squares80.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. *-commutative80.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*80.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-prod80.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-unprod44.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-sqrt54.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-eval54.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. *-commutative54.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*54.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-prod54.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-unprod44.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-sqrt80.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-eval80.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-rr80.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} \]

    if 1e270 < (*.f64 (*.f64 y #s(literal 4 binary64)) y)

    1. Initial program 4.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-sqrt4.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-squares4.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. *-commutative4.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*4.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-prod4.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-unprod2.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-sqrt3.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-eval3.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. *-commutative3.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*3.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-prod3.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-unprod2.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-sqrt4.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-eval4.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-rr4.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-sqrt4.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-frac7.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. +-commutative7.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-define7.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. +-commutative7.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 36.4%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \]
    8. Step-by-step derivation
      1. fma-undefine99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\frac{x + y \cdot 2}{\mathsf{hypot}\left(y \cdot 2, x\right)} \cdot \left(1 + -2 \cdot \frac{y}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+270}:\\ \;\;\;\;\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(y \cdot 2, x\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 65.7% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 10^{+270}:\\
\;\;\;\;\frac{\left(x + y\_m \cdot 2\right) \cdot \left(x - y\_m \cdot 2\right)}{t\_0 + x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 5.0000000000000002e-157

    1. Initial program 53.9%

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

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

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

        \[\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*53.9%

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

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

        \[\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-sqrt49.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-eval49.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. *-commutative49.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*49.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-prod49.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-unprod28.1%

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

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

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

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

        \[\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-frac55.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. +-commutative55.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-define55.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. +-commutative55.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around 0 48.3%

      \[\leadsto \color{blue}{\left(1 + 2 \cdot \frac{y}{x}\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \]
    8. Step-by-step derivation
      1. fma-undefine99.9%

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

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

    if 5.0000000000000002e-157 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 1e270

    1. Initial program 80.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-sqrt80.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-squares80.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. *-commutative80.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*80.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-prod80.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-unprod44.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-sqrt54.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-eval54.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. *-commutative54.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*54.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-prod54.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-unprod44.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-sqrt80.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-eval80.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-rr80.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} \]

    if 1e270 < (*.f64 (*.f64 y #s(literal 4 binary64)) y)

    1. Initial program 4.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-sqrt4.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-squares4.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. *-commutative4.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*4.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-prod4.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-unprod2.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-sqrt3.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-eval3.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. *-commutative3.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*3.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-prod3.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-unprod2.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-sqrt4.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-eval4.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-rr4.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-sqrt4.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-frac7.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. +-commutative7.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-define7.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. +-commutative7.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 36.4%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \]
    8. Step-by-step derivation
      1. fma-undefine99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\frac{x + y \cdot -2}{\mathsf{hypot}\left(y \cdot 2, x\right)} \cdot \left(1 + 2 \cdot \frac{y}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+270}:\\ \;\;\;\;\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(y \cdot 2, x\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.7% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\
\;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\

\mathbf{elif}\;t\_0 \leq 10^{+270}:\\
\;\;\;\;\frac{\left(x + y\_m \cdot 2\right) \cdot \left(x - y\_m \cdot 2\right)}{t\_0 + x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 5.0000000000000002e-157

    1. Initial program 53.9%

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

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

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

        \[\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*53.9%

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

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

        \[\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-sqrt49.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-eval49.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. *-commutative49.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*49.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-prod49.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-unprod28.1%

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

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

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

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

        \[\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-frac55.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. +-commutative55.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-define55.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. +-commutative55.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around 0 48.3%

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

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

    if 5.0000000000000002e-157 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 1e270

    1. Initial program 80.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-sqrt80.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-squares80.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. *-commutative80.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*80.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-prod80.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-unprod44.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-sqrt54.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-eval54.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. *-commutative54.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*54.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-prod54.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-unprod44.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-sqrt80.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-eval80.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-rr80.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} \]

    if 1e270 < (*.f64 (*.f64 y #s(literal 4 binary64)) y)

    1. Initial program 4.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-sqrt4.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-squares4.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. *-commutative4.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*4.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-prod4.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-unprod2.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-sqrt3.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-eval3.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. *-commutative3.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*3.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-prod3.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-unprod2.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-sqrt4.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-eval4.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-rr4.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-sqrt4.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-frac7.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. +-commutative7.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-define7.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. +-commutative7.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 36.4%

      \[\leadsto \color{blue}{\left(1 + 0.5 \cdot \frac{x}{y}\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)} \]
    8. Step-by-step derivation
      1. fma-undefine99.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\left(1 + -2 \cdot \frac{y}{x}\right) \cdot \left(1 + 2 \cdot \frac{y}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 10^{+270}:\\ \;\;\;\;\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(y \cdot 2, x\right)} \cdot \left(1 + 0.5 \cdot \frac{x}{y}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.7% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\ t_1 := 0.5 \cdot \frac{x}{y\_m}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+254}:\\ \;\;\;\;\frac{\left(x + y\_m \cdot 2\right) \cdot \left(x - y\_m \cdot 2\right)}{t\_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + t\_1\right) \cdot \left(t\_1 + -1\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (* 0.5 (/ x y_m))))
   (if (<= t_0 5e-157)
     (* (+ 1.0 (* -2.0 (/ y_m x))) (+ 1.0 (* 2.0 (/ y_m x))))
     (if (<= t_0 2e+254)
       (/ (* (+ x (* y_m 2.0)) (- x (* y_m 2.0))) (+ t_0 (* x x)))
       (* (+ 1.0 t_1) (+ t_1 -1.0))))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = y_m * (y_m * 4.0);
	double t_1 = 0.5 * (x / y_m);
	double tmp;
	if (t_0 <= 5e-157) {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	} else if (t_0 <= 2e+254) {
		tmp = ((x + (y_m * 2.0)) * (x - (y_m * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y_m * (y_m * 4.0d0)
    t_1 = 0.5d0 * (x / y_m)
    if (t_0 <= 5d-157) then
        tmp = (1.0d0 + ((-2.0d0) * (y_m / x))) * (1.0d0 + (2.0d0 * (y_m / x)))
    else if (t_0 <= 2d+254) then
        tmp = ((x + (y_m * 2.0d0)) * (x - (y_m * 2.0d0))) / (t_0 + (x * x))
    else
        tmp = (1.0d0 + t_1) * (t_1 + (-1.0d0))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = y_m * (y_m * 4.0);
	double t_1 = 0.5 * (x / y_m);
	double tmp;
	if (t_0 <= 5e-157) {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	} else if (t_0 <= 2e+254) {
		tmp = ((x + (y_m * 2.0)) * (x - (y_m * 2.0))) / (t_0 + (x * x));
	} else {
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = y_m * (y_m * 4.0)
	t_1 = 0.5 * (x / y_m)
	tmp = 0
	if t_0 <= 5e-157:
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)))
	elif t_0 <= 2e+254:
		tmp = ((x + (y_m * 2.0)) * (x - (y_m * 2.0))) / (t_0 + (x * x))
	else:
		tmp = (1.0 + t_1) * (t_1 + -1.0)
	return tmp
y_m = abs(y)
function code(x, y_m)
	t_0 = Float64(y_m * Float64(y_m * 4.0))
	t_1 = Float64(0.5 * Float64(x / y_m))
	tmp = 0.0
	if (t_0 <= 5e-157)
		tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(y_m / x))) * Float64(1.0 + Float64(2.0 * Float64(y_m / x))));
	elseif (t_0 <= 2e+254)
		tmp = Float64(Float64(Float64(x + Float64(y_m * 2.0)) * Float64(x - Float64(y_m * 2.0))) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(1.0 + t_1) * Float64(t_1 + -1.0));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	t_0 = y_m * (y_m * 4.0);
	t_1 = 0.5 * (x / y_m);
	tmp = 0.0;
	if (t_0 <= 5e-157)
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	elseif (t_0 <= 2e+254)
		tmp = ((x + (y_m * 2.0)) * (x - (y_m * 2.0))) / (t_0 + (x * x));
	else
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-157], N[(N[(1.0 + N[(-2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+254], N[(N[(N[(x + N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x - N[(y$95$m * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$1), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\
\;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+254}:\\
\;\;\;\;\frac{\left(x + y\_m \cdot 2\right) \cdot \left(x - y\_m \cdot 2\right)}{t\_0 + x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 5.0000000000000002e-157

    1. Initial program 53.9%

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

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

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

        \[\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*53.9%

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

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

        \[\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-sqrt49.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-eval49.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. *-commutative49.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*49.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-prod49.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-unprod28.1%

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

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

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

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

        \[\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-frac55.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. +-commutative55.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-define55.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. +-commutative55.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around 0 48.3%

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

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

    if 5.0000000000000002e-157 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 1.9999999999999999e254

    1. Initial program 79.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-sqrt79.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-squares79.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. *-commutative79.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*79.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-prod79.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-unprod42.4%

        \[\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-sqrt52.3%

        \[\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-eval52.3%

        \[\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. *-commutative52.3%

        \[\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*52.3%

        \[\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-prod52.3%

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

        \[\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-sqrt79.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-eval79.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-rr79.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} \]

    if 1.9999999999999999e254 < (*.f64 (*.f64 y #s(literal 4 binary64)) y)

    1. Initial program 9.9%

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

        \[\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-squares9.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. *-commutative9.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*9.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-prod9.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-unprod8.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-sqrt8.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-eval8.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. *-commutative8.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*8.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-prod8.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-unprod8.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-sqrt9.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-eval9.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-rr9.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-sqrt9.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-frac12.6%

        \[\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. +-commutative12.6%

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

        \[\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. +-commutative12.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 39.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(y \cdot 4\right) \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\left(1 + -2 \cdot \frac{y}{x}\right) \cdot \left(1 + 2 \cdot \frac{y}{x}\right)\\ \mathbf{elif}\;y \cdot \left(y \cdot 4\right) \leq 2 \cdot 10^{+254}:\\ \;\;\;\;\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(1 + 0.5 \cdot \frac{x}{y}\right) \cdot \left(0.5 \cdot \frac{x}{y} + -1\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 80.7% accurate, 0.5× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\ t_1 := 0.5 \cdot \frac{x}{y\_m}\\ \mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\ \;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+254}:\\ \;\;\;\;\frac{x \cdot x - t\_0}{t\_0 + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + t\_1\right) \cdot \left(t\_1 + -1\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (* y_m (* y_m 4.0))) (t_1 (* 0.5 (/ x y_m))))
   (if (<= t_0 5e-157)
     (* (+ 1.0 (* -2.0 (/ y_m x))) (+ 1.0 (* 2.0 (/ y_m x))))
     (if (<= t_0 2e+254)
       (/ (- (* x x) t_0) (+ t_0 (* x x)))
       (* (+ 1.0 t_1) (+ t_1 -1.0))))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = y_m * (y_m * 4.0);
	double t_1 = 0.5 * (x / y_m);
	double tmp;
	if (t_0 <= 5e-157) {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	} else if (t_0 <= 2e+254) {
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	} else {
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = y_m * (y_m * 4.0d0)
    t_1 = 0.5d0 * (x / y_m)
    if (t_0 <= 5d-157) then
        tmp = (1.0d0 + ((-2.0d0) * (y_m / x))) * (1.0d0 + (2.0d0 * (y_m / x)))
    else if (t_0 <= 2d+254) then
        tmp = ((x * x) - t_0) / (t_0 + (x * x))
    else
        tmp = (1.0d0 + t_1) * (t_1 + (-1.0d0))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = y_m * (y_m * 4.0);
	double t_1 = 0.5 * (x / y_m);
	double tmp;
	if (t_0 <= 5e-157) {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	} else if (t_0 <= 2e+254) {
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	} else {
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = y_m * (y_m * 4.0)
	t_1 = 0.5 * (x / y_m)
	tmp = 0
	if t_0 <= 5e-157:
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)))
	elif t_0 <= 2e+254:
		tmp = ((x * x) - t_0) / (t_0 + (x * x))
	else:
		tmp = (1.0 + t_1) * (t_1 + -1.0)
	return tmp
y_m = abs(y)
function code(x, y_m)
	t_0 = Float64(y_m * Float64(y_m * 4.0))
	t_1 = Float64(0.5 * Float64(x / y_m))
	tmp = 0.0
	if (t_0 <= 5e-157)
		tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(y_m / x))) * Float64(1.0 + Float64(2.0 * Float64(y_m / x))));
	elseif (t_0 <= 2e+254)
		tmp = Float64(Float64(Float64(x * x) - t_0) / Float64(t_0 + Float64(x * x)));
	else
		tmp = Float64(Float64(1.0 + t_1) * Float64(t_1 + -1.0));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	t_0 = y_m * (y_m * 4.0);
	t_1 = 0.5 * (x / y_m);
	tmp = 0.0;
	if (t_0 <= 5e-157)
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	elseif (t_0 <= 2e+254)
		tmp = ((x * x) - t_0) / (t_0 + (x * x));
	else
		tmp = (1.0 + t_1) * (t_1 + -1.0);
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(y$95$m * N[(y$95$m * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 5e-157], N[(N[(1.0 + N[(-2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+254], N[(N[(N[(x * x), $MachinePrecision] - t$95$0), $MachinePrecision] / N[(t$95$0 + N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + t$95$1), $MachinePrecision] * N[(t$95$1 + -1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := y\_m \cdot \left(y\_m \cdot 4\right)\\
t_1 := 0.5 \cdot \frac{x}{y\_m}\\
\mathbf{if}\;t\_0 \leq 5 \cdot 10^{-157}:\\
\;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\

\mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+254}:\\
\;\;\;\;\frac{x \cdot x - t\_0}{t\_0 + x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 5.0000000000000002e-157

    1. Initial program 53.9%

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

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

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

        \[\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*53.9%

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

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

        \[\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-sqrt49.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-eval49.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. *-commutative49.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*49.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-prod49.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-unprod28.1%

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

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

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

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

        \[\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-frac55.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. +-commutative55.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-define55.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. +-commutative55.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around 0 48.3%

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

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

    if 5.0000000000000002e-157 < (*.f64 (*.f64 y #s(literal 4 binary64)) y) < 1.9999999999999999e254

    1. Initial program 79.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

    if 1.9999999999999999e254 < (*.f64 (*.f64 y #s(literal 4 binary64)) y)

    1. Initial program 9.9%

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

        \[\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-squares9.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. *-commutative9.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*9.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-prod9.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-unprod8.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-sqrt8.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-eval8.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. *-commutative8.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*8.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-prod8.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-unprod8.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-sqrt9.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-eval9.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-rr9.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-sqrt9.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-frac12.6%

        \[\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. +-commutative12.6%

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

        \[\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. +-commutative12.6%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 39.9%

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

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

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

Alternative 8: 63.1% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{y\_m}\\ \mathbf{if}\;x \leq 6.5 \cdot 10^{+53}:\\ \;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;\left(1 + -2 \cdot \frac{y\_m}{x}\right) \cdot \left(1 + 2 \cdot \frac{y\_m}{x}\right)\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x y_m))))
   (if (<= x 6.5e+53)
     (* (+ 1.0 t_0) (+ t_0 -1.0))
     (* (+ 1.0 (* -2.0 (/ y_m x))) (+ 1.0 (* 2.0 (/ y_m x)))))))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = 0.5 * (x / y_m);
	double tmp;
	if (x <= 6.5e+53) {
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	} else {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (x / y_m)
    if (x <= 6.5d+53) then
        tmp = (1.0d0 + t_0) * (t_0 + (-1.0d0))
    else
        tmp = (1.0d0 + ((-2.0d0) * (y_m / x))) * (1.0d0 + (2.0d0 * (y_m / x)))
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = 0.5 * (x / y_m);
	double tmp;
	if (x <= 6.5e+53) {
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	} else {
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = 0.5 * (x / y_m)
	tmp = 0
	if x <= 6.5e+53:
		tmp = (1.0 + t_0) * (t_0 + -1.0)
	else:
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)))
	return tmp
y_m = abs(y)
function code(x, y_m)
	t_0 = Float64(0.5 * Float64(x / y_m))
	tmp = 0.0
	if (x <= 6.5e+53)
		tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0));
	else
		tmp = Float64(Float64(1.0 + Float64(-2.0 * Float64(y_m / x))) * Float64(1.0 + Float64(2.0 * Float64(y_m / x))));
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	t_0 = 0.5 * (x / y_m);
	tmp = 0.0;
	if (x <= 6.5e+53)
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	else
		tmp = (1.0 + (-2.0 * (y_m / x))) * (1.0 + (2.0 * (y_m / x)));
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 6.5e+53], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(-2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(1.0 + N[(2.0 * N[(y$95$m / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{y\_m}\\
\mathbf{if}\;x \leq 6.5 \cdot 10^{+53}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\

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


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

    1. Initial program 55.9%

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

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

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

        \[\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*55.9%

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

        \[\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-unprod30.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-sqrt40.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-eval40.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. *-commutative40.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*40.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-prod40.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-unprod30.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-sqrt55.9%

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

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

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

        \[\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-frac57.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. +-commutative57.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-define57.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. +-commutative57.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 31.7%

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

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

    if 6.50000000000000017e53 < x

    1. Initial program 33.3%

      \[\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-sqrt33.3%

        \[\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-squares33.3%

        \[\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. *-commutative33.3%

        \[\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*33.3%

        \[\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-prod33.3%

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

        \[\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-sqrt33.3%

        \[\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-eval33.3%

        \[\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. *-commutative33.3%

        \[\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*33.3%

        \[\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-prod33.3%

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

        \[\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-sqrt33.3%

        \[\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-eval33.3%

        \[\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-rr33.3%

      \[\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-sqrt33.3%

        \[\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-frac35.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. +-commutative35.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-define35.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. +-commutative35.4%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around 0 82.8%

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

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

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

Alternative 9: 62.9% accurate, 0.9× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} t_0 := 0.5 \cdot \frac{x}{y\_m}\\ \mathbf{if}\;x \leq 2.3 \cdot 10^{+56}:\\ \;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m)
 :precision binary64
 (let* ((t_0 (* 0.5 (/ x y_m))))
   (if (<= x 2.3e+56) (* (+ 1.0 t_0) (+ t_0 -1.0)) 1.0)))
y_m = fabs(y);
double code(double x, double y_m) {
	double t_0 = 0.5 * (x / y_m);
	double tmp;
	if (x <= 2.3e+56) {
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * (x / y_m)
    if (x <= 2.3d+56) then
        tmp = (1.0d0 + t_0) * (t_0 + (-1.0d0))
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double t_0 = 0.5 * (x / y_m);
	double tmp;
	if (x <= 2.3e+56) {
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	} else {
		tmp = 1.0;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	t_0 = 0.5 * (x / y_m)
	tmp = 0
	if x <= 2.3e+56:
		tmp = (1.0 + t_0) * (t_0 + -1.0)
	else:
		tmp = 1.0
	return tmp
y_m = abs(y)
function code(x, y_m)
	t_0 = Float64(0.5 * Float64(x / y_m))
	tmp = 0.0
	if (x <= 2.3e+56)
		tmp = Float64(Float64(1.0 + t_0) * Float64(t_0 + -1.0));
	else
		tmp = 1.0;
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	t_0 = 0.5 * (x / y_m);
	tmp = 0.0;
	if (x <= 2.3e+56)
		tmp = (1.0 + t_0) * (t_0 + -1.0);
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := Block[{t$95$0 = N[(0.5 * N[(x / y$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, 2.3e+56], N[(N[(1.0 + t$95$0), $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
t_0 := 0.5 \cdot \frac{x}{y\_m}\\
\mathbf{if}\;x \leq 2.3 \cdot 10^{+56}:\\
\;\;\;\;\left(1 + t\_0\right) \cdot \left(t\_0 + -1\right)\\

\mathbf{else}:\\
\;\;\;\;1\\


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

    1. Initial program 55.9%

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

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

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

        \[\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*55.9%

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

        \[\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-unprod30.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-sqrt40.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-eval40.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. *-commutative40.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*40.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-prod40.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-unprod30.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-sqrt55.9%

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

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

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

        \[\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-frac57.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. +-commutative57.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-define57.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. +-commutative57.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(y, 2, x\right)}{\mathsf{hypot}\left(\color{blue}{y} \cdot 2, x\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(y \cdot 2, x\right)} \cdot \frac{\mathsf{fma}\left(y, -2, x\right)}{\mathsf{hypot}\left(y \cdot 2, x\right)}} \]
    7. Taylor expanded in y around inf 31.7%

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

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

    if 2.30000000000000015e56 < x

    1. Initial program 33.3%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. *-commutative33.3%

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

        \[\leadsto \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]
      3. *-commutative33.3%

        \[\leadsto \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(y \cdot 4\right)}\right)} \]
    3. Simplified33.3%

      \[\leadsto \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 81.8%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification66.5%

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

Alternative 10: 62.0% accurate, 3.2× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ \begin{array}{l} \mathbf{if}\;x \leq 5.8 \cdot 10^{+54}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m) :precision binary64 (if (<= x 5.8e+54) -1.0 1.0))
y_m = fabs(y);
double code(double x, double y_m) {
	double tmp;
	if (x <= 5.8e+54) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    real(8) :: tmp
    if (x <= 5.8d+54) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	double tmp;
	if (x <= 5.8e+54) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
y_m = math.fabs(y)
def code(x, y_m):
	tmp = 0
	if x <= 5.8e+54:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
y_m = abs(y)
function code(x, y_m)
	tmp = 0.0
	if (x <= 5.8e+54)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
y_m = abs(y);
function tmp_2 = code(x, y_m)
	tmp = 0.0;
	if (x <= 5.8e+54)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := If[LessEqual[x, 5.8e+54], -1.0, 1.0]
\begin{array}{l}
y_m = \left|y\right|

\\
\begin{array}{l}
\mathbf{if}\;x \leq 5.8 \cdot 10^{+54}:\\
\;\;\;\;-1\\

\mathbf{else}:\\
\;\;\;\;1\\


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

    1. Initial program 55.9%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. *-commutative55.9%

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

        \[\leadsto \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]
      3. *-commutative55.9%

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

      \[\leadsto \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 61.2%

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

    if 5.7999999999999997e54 < x

    1. Initial program 33.3%

      \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. Step-by-step derivation
      1. *-commutative33.3%

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

        \[\leadsto \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\color{blue}{\mathsf{fma}\left(x, x, \left(y \cdot 4\right) \cdot y\right)}} \]
      3. *-commutative33.3%

        \[\leadsto \frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, \color{blue}{y \cdot \left(y \cdot 4\right)}\right)} \]
    3. Simplified33.3%

      \[\leadsto \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around inf 81.8%

      \[\leadsto \color{blue}{1} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 50.1% accurate, 19.0× speedup?

\[\begin{array}{l} y_m = \left|y\right| \\ -1 \end{array} \]
y_m = (fabs.f64 y)
(FPCore (x y_m) :precision binary64 -1.0)
y_m = fabs(y);
double code(double x, double y_m) {
	return -1.0;
}
y_m = abs(y)
real(8) function code(x, y_m)
    real(8), intent (in) :: x
    real(8), intent (in) :: y_m
    code = -1.0d0
end function
y_m = Math.abs(y);
public static double code(double x, double y_m) {
	return -1.0;
}
y_m = math.fabs(y)
def code(x, y_m):
	return -1.0
y_m = abs(y)
function code(x, y_m)
	return -1.0
end
y_m = abs(y);
function tmp = code(x, y_m)
	tmp = -1.0;
end
y_m = N[Abs[y], $MachinePrecision]
code[x_, y$95$m_] := -1.0
\begin{array}{l}
y_m = \left|y\right|

\\
-1
\end{array}
Derivation
  1. Initial program 51.2%

    \[\frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
  2. Step-by-step derivation
    1. *-commutative51.2%

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

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

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

    \[\leadsto \color{blue}{\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{\mathsf{fma}\left(x, x, y \cdot \left(y \cdot 4\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 52.5%

    \[\leadsto \color{blue}{-1} \]
  6. Add Preprocessing

Developer Target 1: 51.2% 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 2024170 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:arcBetween from diagrams-lib-1.3.0.3"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (/ (- (* x x) (* (* y 4) y)) (+ (* x x) (* (* y 4) y))) 9743233849626781/10000000000000000) (- (/ (* x x) (+ (* x x) (* (* y y) 4))) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4)))) 2) (/ (* (* y y) 4) (+ (* x x) (* (* y y) 4))))))

  (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))))