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

Percentage Accurate: 50.3% → 86.5%
Time: 12.5s
Alternatives: 9
Speedup: 3.7×

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.3% 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: 86.5% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+102}:\\
\;\;\;\;\frac{x \cdot x - t_0}{t_0 + x \cdot x}\\

\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+261}:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 y 4) y) < 1e6 or 5e102 < (*.f64 (*.f64 y 4) y) < 1.9999999999999999e261

    1. Initial program 65.8%

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

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    3. Step-by-step derivation
      1. cancel-sign-sub-inv53.7%

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

        \[\leadsto \left(1 + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) + \left(-4\right) \cdot \frac{{y}^{2}}{{x}^{2}} \]
      3. associate-*r/53.7%

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      9. associate-*r/53.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \color{blue}{\left(\left(y \cdot y\right) \cdot 4\right)} \cdot \frac{1}{x \cdot x} \]
      11. metadata-eval52.4%

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(\left(y \cdot y\right) \cdot \color{blue}{\left(--4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      12. distribute-rgt-neg-in52.4%

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(-\color{blue}{y \cdot \left(y \cdot -4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      14. cancel-sign-sub-inv52.4%

        \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) - \left(y \cdot \left(y \cdot -4\right)\right) \cdot \frac{1}{x \cdot x}} \]
      15. div-inv52.4%

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

      \[\leadsto \color{blue}{\frac{\left(1 + {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) \cdot x - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative59.9%

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

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

        \[\leadsto \frac{\left(\color{blue}{x} + x \cdot {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      4. associate-/l*59.9%

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

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \color{blue}{\left(1 + {\left(\frac{y \cdot 2}{x}\right)}^{2}\right)} \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      7. associate-/l*60.6%

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\color{blue}{x \cdot \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right)}} \]
      9. distribute-lft-in60.6%

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

      \[\leadsto \color{blue}{\frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u58.7%

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      3. pow-pow58.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(\frac{y}{\frac{x}{2}}\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      4. div-inv58.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{\color{blue}{x \cdot \frac{1}{2}}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      5. metadata-eval58.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot \color{blue}{0.5}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      6. metadata-eval58.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{\color{blue}{4}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    10. Applied egg-rr58.7%

      \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    11. Step-by-step derivation
      1. expm1-def58.8%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-log1p60.6%

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

      \[\leadsto \frac{\left(x + \color{blue}{x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    13. Taylor expanded in x around 0 82.1%

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

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

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

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

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

    if 1e6 < (*.f64 (*.f64 y 4) y) < 5e102

    1. Initial program 95.0%

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

    if 1.9999999999999999e261 < (*.f64 (*.f64 y 4) y)

    1. Initial program 14.8%

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

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    3. Step-by-step derivation
      1. cancel-sign-sub-inv4.9%

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

        \[\leadsto \left(1 + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) + \left(-4\right) \cdot \frac{{y}^{2}}{{x}^{2}} \]
      3. associate-*r/4.9%

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      9. associate-*r/4.9%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}} \]
    5. Step-by-step derivation
      1. div-inv4.9%

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \color{blue}{\left(\left(y \cdot y\right) \cdot 4\right)} \cdot \frac{1}{x \cdot x} \]
      11. metadata-eval2.6%

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(\left(y \cdot y\right) \cdot \color{blue}{\left(--4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      12. distribute-rgt-neg-in2.6%

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(-\color{blue}{y \cdot \left(y \cdot -4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      14. cancel-sign-sub-inv2.6%

        \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) - \left(y \cdot \left(y \cdot -4\right)\right) \cdot \frac{1}{x \cdot x}} \]
      15. div-inv2.6%

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

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

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

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

        \[\leadsto \frac{\left(\color{blue}{x} + x \cdot {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      4. associate-/l*2.7%

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

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \color{blue}{\left(1 + {\left(\frac{y \cdot 2}{x}\right)}^{2}\right)} \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      7. associate-/l*14.8%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u4.7%

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

        \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      3. pow-pow4.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(\frac{y}{\frac{x}{2}}\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      4. div-inv4.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{\color{blue}{x \cdot \frac{1}{2}}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      5. metadata-eval4.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot \color{blue}{0.5}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      6. metadata-eval4.7%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{\color{blue}{4}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    10. Applied egg-rr4.7%

      \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    11. Step-by-step derivation
      1. expm1-def4.7%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-log1p14.9%

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

      \[\leadsto \frac{\left(x + \color{blue}{x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    13. Taylor expanded in x around 0 76.6%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    14. Step-by-step derivation
      1. sub-neg76.6%

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

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

        \[\leadsto \color{blue}{-1 + 0.5 \cdot \frac{{x}^{2}}{{y}^{2}}} \]
      4. associate-*r/76.6%

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

        \[\leadsto -1 + \color{blue}{\frac{0.5}{\frac{{y}^{2}}{{x}^{2}}}} \]
      6. unpow276.6%

        \[\leadsto -1 + \frac{0.5}{\frac{\color{blue}{y \cdot y}}{{x}^{2}}} \]
      7. unpow276.6%

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

        \[\leadsto -1 + \frac{0.5}{\color{blue}{\frac{y}{x} \cdot \frac{y}{x}}} \]
      9. unpow287.1%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}} \]
    15. Simplified87.1%

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

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

Alternative 2: 81.0% accurate, 0.1× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{x \cdot x - t_0}{t_0 + x \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\log \left(1 + \frac{\frac{y}{x}}{\frac{x}{y}}\right), -8, 1\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 9.99999999999999992e-221

    1. Initial program 51.9%

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

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    3. Step-by-step derivation
      1. cancel-sign-sub-inv3.6%

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

        \[\leadsto \left(1 + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) + \left(-4\right) \cdot \frac{{y}^{2}}{{x}^{2}} \]
      3. associate-*r/3.6%

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      9. associate-*r/3.6%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}} \]
    5. Step-by-step derivation
      1. div-inv3.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(\left(y \cdot y\right) \cdot \color{blue}{\left(--4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      12. distribute-rgt-neg-in1.2%

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(-\color{blue}{y \cdot \left(y \cdot -4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      14. cancel-sign-sub-inv1.2%

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

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

      \[\leadsto \color{blue}{\frac{\left(1 + {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) \cdot x - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative11.3%

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

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

        \[\leadsto \frac{\left(\color{blue}{x} + x \cdot {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      4. associate-/l*11.3%

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

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \color{blue}{\left(1 + {\left(\frac{y \cdot 2}{x}\right)}^{2}\right)} \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      7. associate-/l*12.3%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-udef12.1%

        \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      3. pow-pow12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(\frac{y}{\frac{x}{2}}\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      4. div-inv12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{\color{blue}{x \cdot \frac{1}{2}}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      5. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot \color{blue}{0.5}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      6. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{\color{blue}{4}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    10. Applied egg-rr12.1%

      \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    11. Step-by-step derivation
      1. expm1-def12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-log1p12.3%

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

      \[\leadsto \frac{\left(x + \color{blue}{x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    13. Taylor expanded in x around 0 79.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    14. Step-by-step derivation
      1. sub-neg79.3%

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

        \[\leadsto 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} + \color{blue}{-1} \]
      3. +-commutative79.3%

        \[\leadsto \color{blue}{-1 + 0.5 \cdot \frac{{x}^{2}}{{y}^{2}}} \]
      4. associate-*r/79.3%

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

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

        \[\leadsto -1 + \frac{0.5}{\frac{\color{blue}{y \cdot y}}{{x}^{2}}} \]
      7. unpow279.3%

        \[\leadsto -1 + \frac{0.5}{\frac{y \cdot y}{\color{blue}{x \cdot x}}} \]
      8. times-frac89.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{\frac{y}{x} \cdot \frac{y}{x}}} \]
      9. unpow289.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}} \]
    15. Simplified89.5%

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

    if 9.99999999999999992e-221 < (*.f64 x x) < 4.99999999999999995e131

    1. Initial program 83.6%

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

    if 4.99999999999999995e131 < (*.f64 x x)

    1. Initial program 26.5%

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

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

        \[\leadsto \color{blue}{1 + \left(-4 \cdot \frac{{y}^{2}}{{x}^{2}} - 4 \cdot \frac{{y}^{2}}{{x}^{2}}\right)} \]
      2. distribute-rgt-out--69.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y \cdot y}{\color{blue}{x \cdot x}}, -8, 1\right) \]
      10. times-frac79.6%

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{x} \cdot \frac{y}{x}, -8, 1\right)} \]
    5. Step-by-step derivation
      1. add-log-exp79.1%

        \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(e^{\frac{y}{x} \cdot \frac{y}{x}}\right)}, -8, 1\right) \]
      2. pow279.1%

        \[\leadsto \mathsf{fma}\left(\log \left(e^{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}}\right), -8, 1\right) \]
    6. Applied egg-rr79.1%

      \[\leadsto \mathsf{fma}\left(\color{blue}{\log \left(e^{{\left(\frac{y}{x}\right)}^{2}}\right)}, -8, 1\right) \]
    7. Taylor expanded in y around 0 69.0%

      \[\leadsto \mathsf{fma}\left(\log \color{blue}{\left(1 + \frac{{y}^{2}}{{x}^{2}}\right)}, -8, 1\right) \]
    8. Step-by-step derivation
      1. unpow269.0%

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

        \[\leadsto \mathsf{fma}\left(\log \left(1 + \frac{y \cdot y}{\color{blue}{x \cdot x}}\right), -8, 1\right) \]
      3. times-frac80.7%

        \[\leadsto \mathsf{fma}\left(\log \left(1 + \color{blue}{\frac{y}{x} \cdot \frac{y}{x}}\right), -8, 1\right) \]
      4. unpow280.7%

        \[\leadsto \mathsf{fma}\left(\log \left(1 + \color{blue}{{\left(\frac{y}{x}\right)}^{2}}\right), -8, 1\right) \]
    9. Simplified80.7%

      \[\leadsto \mathsf{fma}\left(\log \color{blue}{\left(1 + {\left(\frac{y}{x}\right)}^{2}\right)}, -8, 1\right) \]
    10. Step-by-step derivation
      1. unpow278.5%

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

        \[\leadsto 1 + -4 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv78.5%

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    11. Applied egg-rr80.7%

      \[\leadsto \mathsf{fma}\left(\log \left(1 + \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}}\right), -8, 1\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{-220}:\\ \;\;\;\;-1 + \frac{0.5}{{\left(\frac{y}{x}\right)}^{2}}\\ \mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\log \left(1 + \frac{\frac{y}{x}}{\frac{x}{y}}\right), -8, 1\right)\\ \end{array} \]

Alternative 3: 80.5% accurate, 0.2× speedup?

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

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

\mathbf{elif}\;x \cdot x \leq 5 \cdot 10^{+131}:\\
\;\;\;\;\frac{x \cdot x - t_0}{t_0 + x \cdot x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 9.99999999999999992e-221

    1. Initial program 51.9%

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

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    3. Step-by-step derivation
      1. cancel-sign-sub-inv3.6%

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

        \[\leadsto \left(1 + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) + \left(-4\right) \cdot \frac{{y}^{2}}{{x}^{2}} \]
      3. associate-*r/3.6%

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      9. associate-*r/3.6%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}} \]
    5. Step-by-step derivation
      1. div-inv3.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(\left(y \cdot y\right) \cdot \color{blue}{\left(--4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      12. distribute-rgt-neg-in1.2%

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(-\color{blue}{y \cdot \left(y \cdot -4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      14. cancel-sign-sub-inv1.2%

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

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

      \[\leadsto \color{blue}{\frac{\left(1 + {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) \cdot x - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative11.3%

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

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

        \[\leadsto \frac{\left(\color{blue}{x} + x \cdot {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      4. associate-/l*11.3%

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

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \color{blue}{\left(1 + {\left(\frac{y \cdot 2}{x}\right)}^{2}\right)} \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      7. associate-/l*12.3%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-udef12.1%

        \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      3. pow-pow12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(\frac{y}{\frac{x}{2}}\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      4. div-inv12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{\color{blue}{x \cdot \frac{1}{2}}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      5. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot \color{blue}{0.5}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      6. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{\color{blue}{4}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    10. Applied egg-rr12.1%

      \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    11. Step-by-step derivation
      1. expm1-def12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-log1p12.3%

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

      \[\leadsto \frac{\left(x + \color{blue}{x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    13. Taylor expanded in x around 0 79.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    14. Step-by-step derivation
      1. sub-neg79.3%

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

        \[\leadsto 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} + \color{blue}{-1} \]
      3. +-commutative79.3%

        \[\leadsto \color{blue}{-1 + 0.5 \cdot \frac{{x}^{2}}{{y}^{2}}} \]
      4. associate-*r/79.3%

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

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

        \[\leadsto -1 + \frac{0.5}{\frac{\color{blue}{y \cdot y}}{{x}^{2}}} \]
      7. unpow279.3%

        \[\leadsto -1 + \frac{0.5}{\frac{y \cdot y}{\color{blue}{x \cdot x}}} \]
      8. times-frac89.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{\frac{y}{x} \cdot \frac{y}{x}}} \]
      9. unpow289.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}} \]
    15. Simplified89.5%

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

    if 9.99999999999999992e-221 < (*.f64 x x) < 4.99999999999999995e131

    1. Initial program 83.6%

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

    if 4.99999999999999995e131 < (*.f64 x x)

    1. Initial program 26.5%

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

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

        \[\leadsto \color{blue}{1 + \left(-4 \cdot \frac{{y}^{2}}{{x}^{2}} - 4 \cdot \frac{{y}^{2}}{{x}^{2}}\right)} \]
      2. distribute-rgt-out--69.0%

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

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{y \cdot y}{\color{blue}{x \cdot x}}, -8, 1\right) \]
      10. times-frac79.6%

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

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

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

Alternative 4: 81.4% accurate, 0.2× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 9.99999999999999992e-221

    1. Initial program 51.9%

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

      \[\leadsto \color{blue}{\left(1 + -4 \cdot \frac{{y}^{2}}{{x}^{2}}\right) - 4 \cdot \frac{{y}^{2}}{{x}^{2}}} \]
    3. Step-by-step derivation
      1. cancel-sign-sub-inv3.6%

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

        \[\leadsto \left(1 + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}}\right) + \left(-4\right) \cdot \frac{{y}^{2}}{{x}^{2}} \]
      3. associate-*r/3.6%

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + -4 \cdot \frac{{y}^{2}}{\color{blue}{x \cdot x}} \]
      9. associate-*r/3.6%

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

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

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

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

      \[\leadsto \color{blue}{\left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}} \]
    5. Step-by-step derivation
      1. div-inv3.6%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(\left(y \cdot y\right) \cdot \color{blue}{\left(--4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      12. distribute-rgt-neg-in1.2%

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

        \[\leadsto \left(1 + \frac{y \cdot \left(y \cdot -4\right)}{x \cdot x}\right) + \left(-\color{blue}{y \cdot \left(y \cdot -4\right)}\right) \cdot \frac{1}{x \cdot x} \]
      14. cancel-sign-sub-inv1.2%

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

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

      \[\leadsto \color{blue}{\frac{\left(1 + {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) \cdot x - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x}} \]
    7. Step-by-step derivation
      1. *-commutative11.3%

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

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

        \[\leadsto \frac{\left(\color{blue}{x} + x \cdot {\left({\left(\frac{y \cdot 2}{x}\right)}^{2}\right)}^{2}\right) - \left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot \frac{y \cdot \left(y \cdot 4\right)}{x}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      4. associate-/l*11.3%

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

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

        \[\leadsto \frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \color{blue}{\left(1 + {\left(\frac{y \cdot 2}{x}\right)}^{2}\right)} \cdot \frac{y}{\frac{x}{y \cdot 4}}}{\left({\left(\frac{y \cdot 2}{x}\right)}^{2} + 1\right) \cdot x} \]
      7. associate-/l*12.3%

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

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

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

      \[\leadsto \color{blue}{\frac{\left(x + x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x}} \]
    9. Step-by-step derivation
      1. expm1-log1p-u12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-udef12.1%

        \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left({\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right)}^{2}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      3. pow-pow12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot \color{blue}{{\left(\frac{y}{\frac{x}{2}}\right)}^{\left(2 \cdot 2\right)}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      4. div-inv12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{\color{blue}{x \cdot \frac{1}{2}}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      5. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot \color{blue}{0.5}}\right)}^{\left(2 \cdot 2\right)}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      6. metadata-eval12.1%

        \[\leadsto \frac{\left(x + \left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{\color{blue}{4}}\right)} - 1\right)\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    10. Applied egg-rr12.1%

      \[\leadsto \frac{\left(x + \color{blue}{\left(e^{\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)} - 1\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    11. Step-by-step derivation
      1. expm1-def12.2%

        \[\leadsto \frac{\left(x + \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}\right)\right)}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
      2. expm1-log1p12.3%

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

      \[\leadsto \frac{\left(x + \color{blue}{x \cdot {\left(\frac{y}{x \cdot 0.5}\right)}^{4}}\right) - \left(1 + {\left(\frac{y}{\frac{x}{2}}\right)}^{2}\right) \cdot \frac{y}{\frac{x}{y \cdot 4}}}{x \cdot {\left(\frac{y}{\frac{x}{2}}\right)}^{2} + x} \]
    13. Taylor expanded in x around 0 79.3%

      \[\leadsto \color{blue}{0.5 \cdot \frac{{x}^{2}}{{y}^{2}} - 1} \]
    14. Step-by-step derivation
      1. sub-neg79.3%

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

        \[\leadsto 0.5 \cdot \frac{{x}^{2}}{{y}^{2}} + \color{blue}{-1} \]
      3. +-commutative79.3%

        \[\leadsto \color{blue}{-1 + 0.5 \cdot \frac{{x}^{2}}{{y}^{2}}} \]
      4. associate-*r/79.3%

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

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

        \[\leadsto -1 + \frac{0.5}{\frac{\color{blue}{y \cdot y}}{{x}^{2}}} \]
      7. unpow279.3%

        \[\leadsto -1 + \frac{0.5}{\frac{y \cdot y}{\color{blue}{x \cdot x}}} \]
      8. times-frac89.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{\frac{y}{x} \cdot \frac{y}{x}}} \]
      9. unpow289.5%

        \[\leadsto -1 + \frac{0.5}{\color{blue}{{\left(\frac{y}{x}\right)}^{2}}} \]
    15. Simplified89.5%

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

    if 9.99999999999999992e-221 < (*.f64 x x) < 9.99999999999999953e270

    1. Initial program 80.6%

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

    if 9.99999999999999953e270 < (*.f64 x x)

    1. Initial program 5.3%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac81.5%

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

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

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

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

        \[\leadsto 1 + -4 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv81.5%

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr81.5%

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

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

Alternative 5: 81.3% accurate, 0.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 x x) < 9.99999999999999992e-221

    1. Initial program 51.9%

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

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{4 \cdot {y}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative50.0%

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

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

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

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. div-sub50.9%

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

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

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

        \[\leadsto \frac{x}{y} \cdot \frac{x}{y \cdot 4} - \color{blue}{1} \]
    6. Applied egg-rr89.4%

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

    if 9.99999999999999992e-221 < (*.f64 x x) < 9.99999999999999953e270

    1. Initial program 80.6%

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

    if 9.99999999999999953e270 < (*.f64 x x)

    1. Initial program 5.3%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac81.5%

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

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

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

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

        \[\leadsto 1 + -4 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv81.5%

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr81.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 10^{-220}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \mathbf{elif}\;x \cdot x \leq 10^{+271}:\\ \;\;\;\;\frac{x \cdot x - y \cdot \left(y \cdot 4\right)}{y \cdot \left(y \cdot 4\right) + x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;1 + -4 \cdot \frac{\frac{y}{x}}{\frac{x}{y}}\\ \end{array} \]

Alternative 6: 75.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \leq -206000000 \lor \neg \left(x \leq 6.5 \cdot 10^{-7}\right):\\
\;\;\;\;1 + -4 \cdot \frac{\frac{y}{x}}{\frac{x}{y}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.06e8 or 6.50000000000000024e-7 < x

    1. Initial program 40.9%

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \frac{y \cdot y}{\color{blue}{x \cdot x}} \]
      3. times-frac76.0%

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr76.0%

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

    if -2.06e8 < x < 6.50000000000000024e-7

    1. Initial program 60.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -206000000 \lor \neg \left(x \leq 6.5 \cdot 10^{-7}\right):\\ \;\;\;\;1 + -4 \cdot \frac{\frac{y}{x}}{\frac{x}{y}}\\ \mathbf{else}:\\ \;\;\;\;-1\\ \end{array} \]

Alternative 7: 75.9% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;x \cdot x \leq 4.25 \cdot 10^{+16}:\\
\;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 x x) < 4.25e16

    1. Initial program 60.5%

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

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{4 \cdot {y}^{2}}} \]
    3. Step-by-step derivation
      1. *-commutative49.8%

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

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

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

      \[\leadsto \frac{x \cdot x - \left(y \cdot 4\right) \cdot y}{\color{blue}{y \cdot \left(y \cdot 4\right)}} \]
    5. Step-by-step derivation
      1. div-sub50.3%

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

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

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

        \[\leadsto \frac{x}{y} \cdot \frac{x}{y \cdot 4} - \color{blue}{1} \]
    6. Applied egg-rr83.0%

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

    if 4.25e16 < (*.f64 x x)

    1. Initial program 40.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 + -4 \cdot \left(\frac{y}{x} \cdot \color{blue}{\frac{1}{\frac{x}{y}}}\right) \]
      3. un-div-inv75.7%

        \[\leadsto 1 + -4 \cdot \color{blue}{\frac{\frac{y}{x}}{\frac{x}{y}}} \]
    9. Applied egg-rr75.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot x \leq 4.25 \cdot 10^{+16}:\\ \;\;\;\;-1 + \frac{x}{y} \cdot \frac{x}{y \cdot 4}\\ \mathbf{else}:\\ \;\;\;\;1 + -4 \cdot \frac{\frac{y}{x}}{\frac{x}{y}}\\ \end{array} \]

Alternative 8: 74.7% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+16}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-7}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (if (<= x -1e+16) 1.0 (if (<= x 2.8e-7) -1.0 1.0)))
double code(double x, double y) {
	double tmp;
	if (x <= -1e+16) {
		tmp = 1.0;
	} else if (x <= 2.8e-7) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1d+16)) then
        tmp = 1.0d0
    else if (x <= 2.8d-7) then
        tmp = -1.0d0
    else
        tmp = 1.0d0
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double tmp;
	if (x <= -1e+16) {
		tmp = 1.0;
	} else if (x <= 2.8e-7) {
		tmp = -1.0;
	} else {
		tmp = 1.0;
	}
	return tmp;
}
def code(x, y):
	tmp = 0
	if x <= -1e+16:
		tmp = 1.0
	elif x <= 2.8e-7:
		tmp = -1.0
	else:
		tmp = 1.0
	return tmp
function code(x, y)
	tmp = 0.0
	if (x <= -1e+16)
		tmp = 1.0;
	elseif (x <= 2.8e-7)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	return tmp
end
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1e+16)
		tmp = 1.0;
	elseif (x <= 2.8e-7)
		tmp = -1.0;
	else
		tmp = 1.0;
	end
	tmp_2 = tmp;
end
code[x_, y_] := If[LessEqual[x, -1e+16], 1.0, If[LessEqual[x, 2.8e-7], -1.0, 1.0]]
\begin{array}{l}

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

\mathbf{elif}\;x \leq 2.8 \cdot 10^{-7}:\\
\;\;\;\;-1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1e16 or 2.80000000000000019e-7 < x

    1. Initial program 40.7%

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

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

    if -1e16 < x < 2.80000000000000019e-7

    1. Initial program 60.1%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+16}:\\ \;\;\;\;1\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-7}:\\ \;\;\;\;-1\\ \mathbf{else}:\\ \;\;\;\;1\\ \end{array} \]

Alternative 9: 50.2% accurate, 19.0× speedup?

\[\begin{array}{l} \\ -1 \end{array} \]
(FPCore (x y) :precision binary64 -1.0)
double code(double x, double y) {
	return -1.0;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = -1.0d0
end function
public static double code(double x, double y) {
	return -1.0;
}
def code(x, y):
	return -1.0
function code(x, y)
	return -1.0
end
function tmp = code(x, y)
	tmp = -1.0;
end
code[x_, y_] := -1.0
\begin{array}{l}

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

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

    \[\leadsto \color{blue}{-1} \]
  3. Final simplification57.7%

    \[\leadsto -1 \]

Developer target: 50.8% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(y \cdot y\right) \cdot 4\\ t_1 := x \cdot x + t_0\\ t_2 := \frac{t_0}{t_1}\\ t_3 := \left(y \cdot 4\right) \cdot y\\ \mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\ \;\;\;\;\frac{x \cdot x}{t_1} - t_2\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\ \end{array} \end{array} \]
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (* (* y y) 4.0))
        (t_1 (+ (* x x) t_0))
        (t_2 (/ t_0 t_1))
        (t_3 (* (* y 4.0) y)))
   (if (< (/ (- (* x x) t_3) (+ (* x x) t_3)) 0.9743233849626781)
     (- (/ (* x x) t_1) t_2)
     (- (pow (/ x (sqrt t_1)) 2.0) t_2))))
double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = pow((x / sqrt(t_1)), 2.0) - t_2;
	}
	return tmp;
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: t_3
    real(8) :: tmp
    t_0 = (y * y) * 4.0d0
    t_1 = (x * x) + t_0
    t_2 = t_0 / t_1
    t_3 = (y * 4.0d0) * y
    if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781d0) then
        tmp = ((x * x) / t_1) - t_2
    else
        tmp = ((x / sqrt(t_1)) ** 2.0d0) - t_2
    end if
    code = tmp
end function
public static double code(double x, double y) {
	double t_0 = (y * y) * 4.0;
	double t_1 = (x * x) + t_0;
	double t_2 = t_0 / t_1;
	double t_3 = (y * 4.0) * y;
	double tmp;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781) {
		tmp = ((x * x) / t_1) - t_2;
	} else {
		tmp = Math.pow((x / Math.sqrt(t_1)), 2.0) - t_2;
	}
	return tmp;
}
def code(x, y):
	t_0 = (y * y) * 4.0
	t_1 = (x * x) + t_0
	t_2 = t_0 / t_1
	t_3 = (y * 4.0) * y
	tmp = 0
	if (((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781:
		tmp = ((x * x) / t_1) - t_2
	else:
		tmp = math.pow((x / math.sqrt(t_1)), 2.0) - t_2
	return tmp
function code(x, y)
	t_0 = Float64(Float64(y * y) * 4.0)
	t_1 = Float64(Float64(x * x) + t_0)
	t_2 = Float64(t_0 / t_1)
	t_3 = Float64(Float64(y * 4.0) * y)
	tmp = 0.0
	if (Float64(Float64(Float64(x * x) - t_3) / Float64(Float64(x * x) + t_3)) < 0.9743233849626781)
		tmp = Float64(Float64(Float64(x * x) / t_1) - t_2);
	else
		tmp = Float64((Float64(x / sqrt(t_1)) ^ 2.0) - t_2);
	end
	return tmp
end
function tmp_2 = code(x, y)
	t_0 = (y * y) * 4.0;
	t_1 = (x * x) + t_0;
	t_2 = t_0 / t_1;
	t_3 = (y * 4.0) * y;
	tmp = 0.0;
	if ((((x * x) - t_3) / ((x * x) + t_3)) < 0.9743233849626781)
		tmp = ((x * x) / t_1) - t_2;
	else
		tmp = ((x / sqrt(t_1)) ^ 2.0) - t_2;
	end
	tmp_2 = tmp;
end
code[x_, y_] := Block[{t$95$0 = N[(N[(y * y), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x * x), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y * 4.0), $MachinePrecision] * y), $MachinePrecision]}, If[Less[N[(N[(N[(x * x), $MachinePrecision] - t$95$3), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision], 0.9743233849626781], N[(N[(N[(x * x), $MachinePrecision] / t$95$1), $MachinePrecision] - t$95$2), $MachinePrecision], N[(N[Power[N[(x / N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \left(y \cdot y\right) \cdot 4\\
t_1 := x \cdot x + t_0\\
t_2 := \frac{t_0}{t_1}\\
t_3 := \left(y \cdot 4\right) \cdot y\\
\mathbf{if}\;\frac{x \cdot x - t_3}{x \cdot x + t_3} < 0.9743233849626781:\\
\;\;\;\;\frac{x \cdot x}{t_1} - t_2\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{x}{\sqrt{t_1}}\right)}^{2} - t_2\\


\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023173 
(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))))