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

Percentage Accurate: 50.1% → 99.9%
Time: 11.5s
Alternatives: 9
Speedup: 1.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 9 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.1% 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} x_m = \left|x\right| \\ \begin{array}{l} t_0 := \mathsf{hypot}\left(x_m, y \cdot 2\right)\\ \frac{\frac{\mathsf{fma}\left(y, 2, x_m\right)}{\frac{t_0}{x_m + y \cdot -2}}}{t_0} \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y)
 :precision binary64
 (let* ((t_0 (hypot x_m (* y 2.0))))
   (/ (/ (fma y 2.0 x_m) (/ t_0 (+ x_m (* y -2.0)))) t_0)))
x_m = fabs(x);
double code(double x_m, double y) {
	double t_0 = hypot(x_m, (y * 2.0));
	return (fma(y, 2.0, x_m) / (t_0 / (x_m + (y * -2.0)))) / t_0;
}
x_m = abs(x)
function code(x_m, y)
	t_0 = hypot(x_m, Float64(y * 2.0))
	return Float64(Float64(fma(y, 2.0, x_m) / Float64(t_0 / Float64(x_m + Float64(y * -2.0)))) / t_0)
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_] := Block[{t$95$0 = N[Sqrt[x$95$m ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision]}, N[(N[(N[(y * 2.0 + x$95$m), $MachinePrecision] / N[(t$95$0 / N[(x$95$m + N[(y * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]]
\begin{array}{l}
x_m = \left|x\right|

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

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

      \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    2. difference-of-squares50.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. *-commutative50.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*50.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-prod50.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-unprod23.7%

      \[\leadsto \frac{\left(x + \color{blue}{\left(\sqrt{y} \cdot \sqrt{y}\right)} \cdot \sqrt{4}\right) \cdot \left(x - \sqrt{\left(y \cdot 4\right) \cdot y}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
    7. add-sqr-sqrt37.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-eval37.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. *-commutative37.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*37.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-prod37.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-unprod23.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-sqrt50.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-eval50.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-rr50.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. *-un-lft-identity50.8%

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
    3. associate-/l*100.0%

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

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

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

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

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

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

Alternative 2: 81.3% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\ \;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\ \mathbf{elif}\;t_0 \leq 10^{+280}:\\ \;\;\;\;\mathsf{fma}\left(y, 2, x_m\right) \cdot \frac{x_m + y \cdot -2}{{\left(\mathsf{hypot}\left(x_m, y \cdot 2\right)\right)}^{2}}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.125, {\left(\frac{x_m}{y}\right)}^{2}, -1\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))))
   (if (<= t_0 4e-149)
     (+ 1.0 (* -8.0 (* (/ y x_m) (/ y x_m))))
     (if (<= t_0 1e+280)
       (*
        (fma y 2.0 x_m)
        (/ (+ x_m (* y -2.0)) (pow (hypot x_m (* y 2.0)) 2.0)))
       (fma 0.125 (pow (/ x_m y) 2.0) -1.0)))))
x_m = fabs(x);
double code(double x_m, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if (t_0 <= 4e-149) {
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)));
	} else if (t_0 <= 1e+280) {
		tmp = fma(y, 2.0, x_m) * ((x_m + (y * -2.0)) / pow(hypot(x_m, (y * 2.0)), 2.0));
	} else {
		tmp = fma(0.125, pow((x_m / y), 2.0), -1.0);
	}
	return tmp;
}
x_m = abs(x)
function code(x_m, y)
	t_0 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if (t_0 <= 4e-149)
		tmp = Float64(1.0 + Float64(-8.0 * Float64(Float64(y / x_m) * Float64(y / x_m))));
	elseif (t_0 <= 1e+280)
		tmp = Float64(fma(y, 2.0, x_m) * Float64(Float64(x_m + Float64(y * -2.0)) / (hypot(x_m, Float64(y * 2.0)) ^ 2.0)));
	else
		tmp = fma(0.125, (Float64(x_m / y) ^ 2.0), -1.0);
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-149], N[(1.0 + N[(-8.0 * N[(N[(y / x$95$m), $MachinePrecision] * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+280], N[(N[(y * 2.0 + x$95$m), $MachinePrecision] * N[(N[(x$95$m + N[(y * -2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Sqrt[x$95$m ^ 2 + N[(y * 2.0), $MachinePrecision] ^ 2], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.125 * N[Power[N[(x$95$m / y), $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

\mathbf{elif}\;t_0 \leq 10^{+280}:\\
\;\;\;\;\mathsf{fma}\left(y, 2, x_m\right) \cdot \frac{x_m + y \cdot -2}{{\left(\mathsf{hypot}\left(x_m, y \cdot 2\right)\right)}^{2}}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.125, {\left(\frac{x_m}{y}\right)}^{2}, -1\right)\\


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

    1. Initial program 55.6%

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

      \[\leadsto \color{blue}{1 + -8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. pow275.8%

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow275.8%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac85.3%

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

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

    if 3.99999999999999992e-149 < (*.f64 (*.f64 y 4) y) < 1e280

    1. Initial program 77.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-sqrt77.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-squares77.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. *-commutative77.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*77.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-prod77.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-unprod37.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-sqrt46.4%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod37.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-sqrt77.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-eval77.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-rr77.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. *-commutative77.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if 1e280 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.8%

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

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares4.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. *-commutative4.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*4.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-prod4.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-unprod0.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-sqrt0.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-eval0.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. *-commutative0.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*0.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-prod0.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-unprod0.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-sqrt4.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-eval4.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-rr4.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. *-un-lft-identity4.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
      2. *-lft-identity7.8%

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      3. associate-/l*100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.125 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    13. Step-by-step derivation
      1. fma-neg69.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.125, \frac{{x}^{2}}{{y}^{2}}, -1\right)} \]
      2. unpow269.5%

        \[\leadsto \mathsf{fma}\left(0.125, \frac{\color{blue}{x \cdot x}}{{y}^{2}}, -1\right) \]
      3. unpow269.5%

        \[\leadsto \mathsf{fma}\left(0.125, \frac{x \cdot x}{\color{blue}{y \cdot y}}, -1\right) \]
      4. times-frac84.4%

        \[\leadsto \mathsf{fma}\left(0.125, \color{blue}{\frac{x}{y} \cdot \frac{x}{y}}, -1\right) \]
      5. unpow284.4%

        \[\leadsto \mathsf{fma}\left(0.125, \color{blue}{{\left(\frac{x}{y}\right)}^{2}}, -1\right) \]
      6. metadata-eval84.4%

        \[\leadsto \mathsf{fma}\left(0.125, {\left(\frac{x}{y}\right)}^{2}, \color{blue}{-1}\right) \]
    14. Simplified84.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.125, {\left(\frac{x}{y}\right)}^{2}, -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.5%

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

Alternative 3: 81.1% accurate, 0.1× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} t_0 := y \cdot \left(y \cdot 4\right)\\ \mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\ \;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\ \mathbf{elif}\;t_0 \leq 10^{+280}:\\ \;\;\;\;\frac{\left(x_m + y \cdot 2\right) \cdot \left(x_m - y \cdot 2\right)}{t_0 + x_m \cdot x_m}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.125, {\left(\frac{x_m}{y}\right)}^{2}, -1\right)\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y)
 :precision binary64
 (let* ((t_0 (* y (* y 4.0))))
   (if (<= t_0 4e-149)
     (+ 1.0 (* -8.0 (* (/ y x_m) (/ y x_m))))
     (if (<= t_0 1e+280)
       (/ (* (+ x_m (* y 2.0)) (- x_m (* y 2.0))) (+ t_0 (* x_m x_m)))
       (fma 0.125 (pow (/ x_m y) 2.0) -1.0)))))
x_m = fabs(x);
double code(double x_m, double y) {
	double t_0 = y * (y * 4.0);
	double tmp;
	if (t_0 <= 4e-149) {
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)));
	} else if (t_0 <= 1e+280) {
		tmp = ((x_m + (y * 2.0)) * (x_m - (y * 2.0))) / (t_0 + (x_m * x_m));
	} else {
		tmp = fma(0.125, pow((x_m / y), 2.0), -1.0);
	}
	return tmp;
}
x_m = abs(x)
function code(x_m, y)
	t_0 = Float64(y * Float64(y * 4.0))
	tmp = 0.0
	if (t_0 <= 4e-149)
		tmp = Float64(1.0 + Float64(-8.0 * Float64(Float64(y / x_m) * Float64(y / x_m))));
	elseif (t_0 <= 1e+280)
		tmp = Float64(Float64(Float64(x_m + Float64(y * 2.0)) * Float64(x_m - Float64(y * 2.0))) / Float64(t_0 + Float64(x_m * x_m)));
	else
		tmp = fma(0.125, (Float64(x_m / y) ^ 2.0), -1.0);
	end
	return tmp
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_] := Block[{t$95$0 = N[(y * N[(y * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 4e-149], N[(1.0 + N[(-8.0 * N[(N[(y / x$95$m), $MachinePrecision] * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+280], N[(N[(N[(x$95$m + N[(y * 2.0), $MachinePrecision]), $MachinePrecision] * N[(x$95$m - N[(y * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 + N[(x$95$m * x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.125 * N[Power[N[(x$95$m / y), $MachinePrecision], 2.0], $MachinePrecision] + -1.0), $MachinePrecision]]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.125, {\left(\frac{x_m}{y}\right)}^{2}, -1\right)\\


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

    1. Initial program 55.6%

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

      \[\leadsto \color{blue}{1 + -8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. pow275.8%

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow275.8%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac85.3%

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

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

    if 3.99999999999999992e-149 < (*.f64 (*.f64 y 4) y) < 1e280

    1. Initial program 77.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-sqrt77.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-squares77.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. *-commutative77.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*77.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-prod77.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-unprod37.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-sqrt46.4%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod37.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-sqrt77.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-eval77.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-rr77.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 1e280 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.8%

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

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares4.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. *-commutative4.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*4.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-prod4.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-unprod0.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-sqrt0.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-eval0.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. *-commutative0.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*0.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-prod0.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-unprod0.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-sqrt4.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-eval4.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-rr4.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. *-un-lft-identity4.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
      2. *-lft-identity7.8%

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      3. associate-/l*100.0%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0.125 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    13. Step-by-step derivation
      1. fma-neg69.5%

        \[\leadsto \color{blue}{\mathsf{fma}\left(0.125, \frac{{x}^{2}}{{y}^{2}}, -1\right)} \]
      2. unpow269.5%

        \[\leadsto \mathsf{fma}\left(0.125, \frac{\color{blue}{x \cdot x}}{{y}^{2}}, -1\right) \]
      3. unpow269.5%

        \[\leadsto \mathsf{fma}\left(0.125, \frac{x \cdot x}{\color{blue}{y \cdot y}}, -1\right) \]
      4. times-frac84.4%

        \[\leadsto \mathsf{fma}\left(0.125, \color{blue}{\frac{x}{y} \cdot \frac{x}{y}}, -1\right) \]
      5. unpow284.4%

        \[\leadsto \mathsf{fma}\left(0.125, \color{blue}{{\left(\frac{x}{y}\right)}^{2}}, -1\right) \]
      6. metadata-eval84.4%

        \[\leadsto \mathsf{fma}\left(0.125, {\left(\frac{x}{y}\right)}^{2}, \color{blue}{-1}\right) \]
    14. Simplified84.4%

      \[\leadsto \color{blue}{\mathsf{fma}\left(0.125, {\left(\frac{x}{y}\right)}^{2}, -1\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification82.3%

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

Alternative 4: 69.8% accurate, 0.2× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

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

\mathbf{else}:\\
\;\;\;\;\frac{y \cdot -2}{\mathsf{hypot}\left(x_m, y \cdot 2\right)}\\


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

    1. Initial program 55.6%

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

      \[\leadsto \color{blue}{1 + -8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. pow275.8%

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow275.8%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac85.3%

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

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

    if 3.99999999999999992e-149 < (*.f64 (*.f64 y 4) y) < 1e280

    1. Initial program 77.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-sqrt77.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-squares77.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. *-commutative77.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*77.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-prod77.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-unprod37.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-sqrt46.4%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod37.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-sqrt77.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-eval77.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-rr77.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 1e280 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.8%

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

        \[\leadsto \frac{x \cdot x - \color{blue}{\sqrt{\left(y \cdot 4\right) \cdot y} \cdot \sqrt{\left(y \cdot 4\right) \cdot y}}}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      2. difference-of-squares4.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. *-commutative4.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*4.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-prod4.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-unprod0.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-sqrt0.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-eval0.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. *-commutative0.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*0.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-prod0.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-unprod0.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-sqrt4.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-eval4.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-rr4.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. *-un-lft-identity4.8%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}{\mathsf{hypot}\left(x, y \cdot 2\right)}} \]
      2. *-lft-identity7.8%

        \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(y, 2, x\right) \cdot \left(x - y \cdot 2\right)}{\mathsf{hypot}\left(x, y \cdot 2\right)}}}{\mathsf{hypot}\left(x, y \cdot 2\right)} \]
      3. associate-/l*100.0%

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

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

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

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

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

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

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

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

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

Alternative 5: 80.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

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

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


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

    1. Initial program 55.6%

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

      \[\leadsto \color{blue}{1 + -8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. pow275.8%

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow275.8%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac85.3%

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

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

    if 3.99999999999999992e-149 < (*.f64 (*.f64 y 4) y) < 1e280

    1. Initial program 77.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-sqrt77.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-squares77.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. *-commutative77.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*77.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-prod77.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-unprod37.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-sqrt46.4%

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

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

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

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

        \[\leadsto \frac{\left(x + y \cdot 2\right) \cdot \left(x - \color{blue}{\sqrt{y \cdot y} \cdot \sqrt{4}}\right)}{x \cdot x + \left(y \cdot 4\right) \cdot y} \]
      12. sqrt-unprod37.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-sqrt77.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-eval77.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-rr77.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 1e280 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.8%

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

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

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

Alternative 6: 80.9% accurate, 0.5× speedup?

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

\\
\begin{array}{l}
t_0 := y \cdot \left(y \cdot 4\right)\\
\mathbf{if}\;t_0 \leq 4 \cdot 10^{-149}:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

\mathbf{elif}\;t_0 \leq 10^{+280}:\\
\;\;\;\;\frac{x_m \cdot x_m - t_0}{t_0 + x_m \cdot x_m}\\

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


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

    1. Initial program 55.6%

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

      \[\leadsto \color{blue}{1 + -8 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    4. Step-by-step derivation
      1. pow275.8%

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow275.8%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac85.3%

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

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

    if 3.99999999999999992e-149 < (*.f64 (*.f64 y 4) y) < 1e280

    1. Initial program 77.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 1e280 < (*.f64 (*.f64 y 4) y)

    1. Initial program 4.8%

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

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

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

Alternative 7: 63.5% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.29:\\
\;\;\;\;1\\

\mathbf{elif}\;y \leq 2 \cdot 10^{+42}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 1.1 \cdot 10^{+49}:\\
\;\;\;\;1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 0.28999999999999998 or 2.00000000000000009e42 < y < 1.1e49

    1. Initial program 53.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. Taylor expanded in x around inf 61.8%

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

    if 0.28999999999999998 < y < 2.00000000000000009e42 or 1.1e49 < y

    1. Initial program 41.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 0.29:\\ \;\;\;\;1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+42}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 1.1 \cdot 10^{+49}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 64.6% accurate, 1.2× speedup?

\[\begin{array}{l} x_m = \left|x\right| \\ \begin{array}{l} \mathbf{if}\;y \leq 0.35:\\ \;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{+43}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+48}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \end{array} \]
x_m = (fabs.f64 x)
(FPCore (x_m y)
 :precision binary64
 (if (<= y 0.35)
   (+ 1.0 (* -8.0 (* (/ y x_m) (/ y x_m))))
   (if (<= y 2.55e+43) -1.0 (if (<= y 2e+48) 1.0 -1.0))))
x_m = fabs(x);
double code(double x_m, double y) {
	double tmp;
	if (y <= 0.35) {
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)));
	} else if (y <= 2.55e+43) {
		tmp = -1.0;
	} else if (y <= 2e+48) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
x_m = abs(x)
real(8) function code(x_m, y)
    real(8), intent (in) :: x_m
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 0.35d0) then
        tmp = 1.0d0 + ((-8.0d0) * ((y / x_m) * (y / x_m)))
    else if (y <= 2.55d+43) then
        tmp = -1.0d0
    else if (y <= 2d+48) then
        tmp = 1.0d0
    else
        tmp = -1.0d0
    end if
    code = tmp
end function
x_m = Math.abs(x);
public static double code(double x_m, double y) {
	double tmp;
	if (y <= 0.35) {
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)));
	} else if (y <= 2.55e+43) {
		tmp = -1.0;
	} else if (y <= 2e+48) {
		tmp = 1.0;
	} else {
		tmp = -1.0;
	}
	return tmp;
}
x_m = math.fabs(x)
def code(x_m, y):
	tmp = 0
	if y <= 0.35:
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)))
	elif y <= 2.55e+43:
		tmp = -1.0
	elif y <= 2e+48:
		tmp = 1.0
	else:
		tmp = -1.0
	return tmp
x_m = abs(x)
function code(x_m, y)
	tmp = 0.0
	if (y <= 0.35)
		tmp = Float64(1.0 + Float64(-8.0 * Float64(Float64(y / x_m) * Float64(y / x_m))));
	elseif (y <= 2.55e+43)
		tmp = -1.0;
	elseif (y <= 2e+48)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	return tmp
end
x_m = abs(x);
function tmp_2 = code(x_m, y)
	tmp = 0.0;
	if (y <= 0.35)
		tmp = 1.0 + (-8.0 * ((y / x_m) * (y / x_m)));
	elseif (y <= 2.55e+43)
		tmp = -1.0;
	elseif (y <= 2e+48)
		tmp = 1.0;
	else
		tmp = -1.0;
	end
	tmp_2 = tmp;
end
x_m = N[Abs[x], $MachinePrecision]
code[x$95$m_, y_] := If[LessEqual[y, 0.35], N[(1.0 + N[(-8.0 * N[(N[(y / x$95$m), $MachinePrecision] * N[(y / x$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.55e+43], -1.0, If[LessEqual[y, 2e+48], 1.0, -1.0]]]
\begin{array}{l}
x_m = \left|x\right|

\\
\begin{array}{l}
\mathbf{if}\;y \leq 0.35:\\
\;\;\;\;1 + -8 \cdot \left(\frac{y}{x_m} \cdot \frac{y}{x_m}\right)\\

\mathbf{elif}\;y \leq 2.55 \cdot 10^{+43}:\\
\;\;\;\;-1\\

\mathbf{elif}\;y \leq 2 \cdot 10^{+48}:\\
\;\;\;\;1\\

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


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

    1. Initial program 53.5%

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

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

        \[\leadsto 1 + -8 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      2. unpow255.9%

        \[\leadsto 1 + -8 \cdot \frac{\color{blue}{y \cdot y}}{x \cdot x} \]
      3. times-frac62.7%

        \[\leadsto 1 + -8 \cdot \color{blue}{\left(\frac{y}{x} \cdot \frac{y}{x}\right)} \]
    5. Applied egg-rr62.7%

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

    if 0.34999999999999998 < y < 2.54999999999999997e43 or 2.00000000000000009e48 < y

    1. Initial program 41.5%

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

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

    if 2.54999999999999997e43 < y < 2.00000000000000009e48

    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. Taylor expanded in x around inf 100.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 0.35:\\ \;\;\;\;1 + -8 \cdot \left(\frac{y}{x} \cdot \frac{y}{x}\right)\\ \mathbf{elif}\;y \leq 2.55 \cdot 10^{+43}:\\ \;\;\;\;-1\\ \mathbf{elif}\;y \leq 2 \cdot 10^{+48}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 49.7% accurate, 19.0× speedup?

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

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

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

    \[\leadsto \color{blue}{-1} \]
  4. Final simplification47.2%

    \[\leadsto -1 \]
  5. Add Preprocessing

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

  :herbie-target
  (if (< (/ (- (* x x) (* (* y 4.0) y)) (+ (* x x) (* (* y 4.0) y))) 0.9743233849626781) (- (/ (* x x) (+ (* x x) (* (* y y) 4.0))) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))) (- (pow (/ x (sqrt (+ (* x x) (* (* y y) 4.0)))) 2.0) (/ (* (* y y) 4.0) (+ (* x x) (* (* y y) 4.0)))))

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