Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A

Percentage Accurate: 68.4% → 98.4%
Time: 13.8s
Alternatives: 14
Speedup: 1.4×

Specification

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

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\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 14 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: 68.4% accurate, 1.0× speedup?

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

\\
\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}
\end{array}

Alternative 1: 98.4% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/
  (* (pow (cbrt y) 2.0) (/ (cbrt y) (+ y x)))
  (* (/ (+ x (+ y 1.0)) x) (+ y x))))
assert(x < y);
double code(double x, double y) {
	return (pow(cbrt(y), 2.0) * (cbrt(y) / (y + x))) / (((x + (y + 1.0)) / x) * (y + x));
}
assert x < y;
public static double code(double x, double y) {
	return (Math.pow(Math.cbrt(y), 2.0) * (Math.cbrt(y) / (y + x))) / (((x + (y + 1.0)) / x) * (y + x));
}
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64((cbrt(y) ^ 2.0) * Float64(cbrt(y) / Float64(y + x))) / Float64(Float64(Float64(x + Float64(y + 1.0)) / x) * Float64(y + x)))
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(N[Power[N[Power[y, 1/3], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[y, 1/3], $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}
\end{array}
Derivation
  1. Initial program 64.2%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\color{blue}{\left(y + x\right)} \cdot \frac{\left(x + y\right) + 1}{x}} \]
    5. associate-+l+97.6%

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

    \[\leadsto \color{blue}{\frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\left(y + x\right) \cdot \frac{x + \left(y + 1\right)}{x}}} \]
  11. Final simplification97.6%

    \[\leadsto \frac{{\left(\sqrt[3]{y}\right)}^{2} \cdot \frac{\sqrt[3]{y}}{y + x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)} \]
  12. Add Preprocessing

Alternative 2: 92.5% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := x + \left(y + 1\right)\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{+26}:\\ \;\;\;\;\frac{\frac{y}{x}}{\frac{t\_0}{x} \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-156}:\\ \;\;\;\;x \cdot \frac{y}{t\_0 \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{-208}:\\ \;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ x (+ y 1.0))))
   (if (<= x -1.65e+26)
     (/ (/ y x) (* (/ t_0 x) (+ y x)))
     (if (<= x -6.6e-156)
       (* x (/ y (* t_0 (* (+ y x) (+ y x)))))
       (if (<= x -6.5e-208)
         (/ (* y (/ x (* (+ y x) (+ 1.0 (+ y x))))) x)
         (/ (/ x y) (+ y 1.0)))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (x <= -1.65e+26) {
		tmp = (y / x) / ((t_0 / x) * (y + x));
	} else if (x <= -6.6e-156) {
		tmp = x * (y / (t_0 * ((y + x) * (y + x))));
	} else if (x <= -6.5e-208) {
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = x + (y + 1.0d0)
    if (x <= (-1.65d+26)) then
        tmp = (y / x) / ((t_0 / x) * (y + x))
    else if (x <= (-6.6d-156)) then
        tmp = x * (y / (t_0 * ((y + x) * (y + x))))
    else if (x <= (-6.5d-208)) then
        tmp = (y * (x / ((y + x) * (1.0d0 + (y + x))))) / x
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = x + (y + 1.0);
	double tmp;
	if (x <= -1.65e+26) {
		tmp = (y / x) / ((t_0 / x) * (y + x));
	} else if (x <= -6.6e-156) {
		tmp = x * (y / (t_0 * ((y + x) * (y + x))));
	} else if (x <= -6.5e-208) {
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = x + (y + 1.0)
	tmp = 0
	if x <= -1.65e+26:
		tmp = (y / x) / ((t_0 / x) * (y + x))
	elif x <= -6.6e-156:
		tmp = x * (y / (t_0 * ((y + x) * (y + x))))
	elif x <= -6.5e-208:
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(x + Float64(y + 1.0))
	tmp = 0.0
	if (x <= -1.65e+26)
		tmp = Float64(Float64(y / x) / Float64(Float64(t_0 / x) * Float64(y + x)));
	elseif (x <= -6.6e-156)
		tmp = Float64(x * Float64(y / Float64(t_0 * Float64(Float64(y + x) * Float64(y + x)))));
	elseif (x <= -6.5e-208)
		tmp = Float64(Float64(y * Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x))))) / x);
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = x + (y + 1.0);
	tmp = 0.0;
	if (x <= -1.65e+26)
		tmp = (y / x) / ((t_0 / x) * (y + x));
	elseif (x <= -6.6e-156)
		tmp = x * (y / (t_0 * ((y + x) * (y + x))));
	elseif (x <= -6.5e-208)
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e+26], N[(N[(y / x), $MachinePrecision] / N[(N[(t$95$0 / x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.6e-156], N[(x * N[(y / N[(t$95$0 * N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.5e-208], N[(N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := x + \left(y + 1\right)\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{y}{x}}{\frac{t\_0}{x} \cdot \left(y + x\right)}\\

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

\mathbf{elif}\;x \leq -6.5 \cdot 10^{-208}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.64999999999999997e26

    1. Initial program 45.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*45.8%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. times-frac78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{x}{\left(y + x\right) + \left(x + y\right) \cdot \left(x + y\right)} \]
    8. Step-by-step derivation
      1. clear-num70.8%

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

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

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

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

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

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

        \[\leadsto \frac{y}{x \cdot \frac{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right)}}{x}} \]
      8. *-un-lft-identity70.7%

        \[\leadsto \frac{y}{x \cdot \frac{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{1 \cdot \left(x + y\right)}}{x}} \]
      9. distribute-rgt-out70.7%

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

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

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

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

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

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

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

    if -1.64999999999999997e26 < x < -6.5999999999999997e-156

    1. Initial program 81.2%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing

    if -6.5999999999999997e-156 < x < -6.4999999999999998e-208

    1. Initial program 67.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*67.2%

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

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

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

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

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(1 + \left(x + y\right)\right)}} \]
      6. distribute-lft-in99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)}}}{x} \]
      4. *-un-lft-identity67.8%

        \[\leadsto \frac{y \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{1 \cdot \left(x + y\right)}}}{x} \]
      5. distribute-rgt-out67.8%

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

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

    if -6.4999999999999998e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 55.9%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified56.3%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/56.7%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv56.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.65 \cdot 10^{+26}:\\ \;\;\;\;\frac{\frac{y}{x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -6.6 \cdot 10^{-156}:\\ \;\;\;\;x \cdot \frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{-208}:\\ \;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 87.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{+117}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.2e+117)
   (/ (/ 1.0 x) (/ (+ y x) y))
   (if (<= x -7e-208)
     (/ (* y (/ x (* (+ y x) (+ 1.0 (+ y x))))) x)
     (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.2e+117) {
		tmp = (1.0 / x) / ((y + x) / y);
	} else if (x <= -7e-208) {
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.2d+117)) then
        tmp = (1.0d0 / x) / ((y + x) / y)
    else if (x <= (-7d-208)) then
        tmp = (y * (x / ((y + x) * (1.0d0 + (y + x))))) / x
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.2e+117) {
		tmp = (1.0 / x) / ((y + x) / y);
	} else if (x <= -7e-208) {
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.2e+117:
		tmp = (1.0 / x) / ((y + x) / y)
	elif x <= -7e-208:
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.2e+117)
		tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + x) / y));
	elseif (x <= -7e-208)
		tmp = Float64(Float64(y * Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x))))) / x);
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.2e+117)
		tmp = (1.0 / x) / ((y + x) / y);
	elseif (x <= -7e-208)
		tmp = (y * (x / ((y + x) * (1.0 + (y + x))))) / x;
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.2e+117], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-208], N[(N[(y * N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1999999999999999e117

    1. Initial program 39.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*39.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. times-frac71.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. *-commutative64.5%

        \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{y + x}} \]
      2. clear-num64.5%

        \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{\frac{y + x}{y}}} \]
      3. un-div-inv64.5%

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{\frac{y + x}{y}}} \]
      4. +-commutative64.5%

        \[\leadsto \frac{\frac{1}{x}}{\frac{\color{blue}{x + y}}{y}} \]
    7. Applied egg-rr64.5%

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

    if -1.1999999999999999e117 < x < -6.99999999999999982e-208

    1. Initial program 75.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)}}}{x} \]
      4. *-un-lft-identity75.8%

        \[\leadsto \frac{y \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{1 \cdot \left(x + y\right)}}}{x} \]
      5. distribute-rgt-out75.9%

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

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

    if -6.99999999999999982e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 55.9%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified56.3%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/56.7%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv56.7%

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

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

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

Alternative 4: 95.5% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 5.5 \cdot 10^{+150}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) + \left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 5.5e+150)
   (* (/ y (+ y x)) (/ x (+ (+ y x) (* (+ y x) (+ y x)))))
   (* (/ x y) (/ 1.0 (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 5.5e+150) {
		tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
	} else {
		tmp = (x / y) * (1.0 / (y + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 5.5d+150) then
        tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))))
    else
        tmp = (x / y) * (1.0d0 / (y + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 5.5e+150) {
		tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
	} else {
		tmp = (x / y) * (1.0 / (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 5.5e+150:
		tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))))
	else:
		tmp = (x / y) * (1.0 / (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 5.5e+150)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(Float64(y + x) + Float64(Float64(y + x) * Float64(y + x)))));
	else
		tmp = Float64(Float64(x / y) * Float64(1.0 / Float64(y + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 5.5e+150)
		tmp = (y / (y + x)) * (x / ((y + x) + ((y + x) * (y + x))));
	else
		tmp = (x / y) * (1.0 / (y + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 5.5e+150], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(y + x), $MachinePrecision] + N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 5.5 \cdot 10^{+150}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) + \left(y + x\right) \cdot \left(y + x\right)}\\

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


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

    1. Initial program 66.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*66.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.50000000000000017e150 < y

    1. Initial program 47.1%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 79.0%

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity79.0%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. *-commutative88.8%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    11. Simplified88.8%

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

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

Alternative 5: 92.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.8 \cdot 10^{+144}:\\ \;\;\;\;y \cdot \frac{\frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \frac{1}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 1.8e+144)
   (* y (/ (/ x (* (+ y x) (+ 1.0 (+ y x)))) (+ y x)))
   (* (/ x y) (/ 1.0 (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.8e+144) {
		tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
	} else {
		tmp = (x / y) * (1.0 / (y + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.8d+144) then
        tmp = y * ((x / ((y + x) * (1.0d0 + (y + x)))) / (y + x))
    else
        tmp = (x / y) * (1.0d0 / (y + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.8e+144) {
		tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
	} else {
		tmp = (x / y) * (1.0 / (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.8e+144:
		tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x))
	else:
		tmp = (x / y) * (1.0 / (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.8e+144)
		tmp = Float64(y * Float64(Float64(x / Float64(Float64(y + x) * Float64(1.0 + Float64(y + x)))) / Float64(y + x)));
	else
		tmp = Float64(Float64(x / y) * Float64(1.0 / Float64(y + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.8e+144)
		tmp = y * ((x / ((y + x) * (1.0 + (y + x)))) / (y + x));
	else
		tmp = (x / y) * (1.0 / (y + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.8e+144], N[(y * N[(N[(x / N[(N[(y + x), $MachinePrecision] * N[(1.0 + N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] * N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{+144}:\\
\;\;\;\;y \cdot \frac{\frac{x}{\left(y + x\right) \cdot \left(1 + \left(y + x\right)\right)}}{y + x}\\

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


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

    1. Initial program 67.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*67.0%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. times-frac96.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)}}}{x + y} \cdot y \]
      9. *-un-lft-identity93.7%

        \[\leadsto \frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{1 \cdot \left(x + y\right)}}}{x + y} \cdot y \]
      10. distribute-rgt-out93.7%

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

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

    if 1.7999999999999999e144 < y

    1. Initial program 47.4%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 80.2%

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity80.2%

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

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

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

      \[\leadsto \color{blue}{\frac{1}{y + 1} \cdot \frac{x}{y}} \]
    10. Step-by-step derivation
      1. *-commutative89.4%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    11. Simplified89.4%

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

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

Alternative 6: 85.9% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.2 \cdot 10^{+117}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-208}:\\ \;\;\;\;\frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.2e+117)
   (/ (/ 1.0 x) (/ (+ y x) y))
   (if (<= x -6.8e-208)
     (/ y (* (+ x (+ y 1.0)) (+ y x)))
     (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.2e+117) {
		tmp = (1.0 / x) / ((y + x) / y);
	} else if (x <= -6.8e-208) {
		tmp = y / ((x + (y + 1.0)) * (y + x));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.2d+117)) then
        tmp = (1.0d0 / x) / ((y + x) / y)
    else if (x <= (-6.8d-208)) then
        tmp = y / ((x + (y + 1.0d0)) * (y + x))
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.2e+117) {
		tmp = (1.0 / x) / ((y + x) / y);
	} else if (x <= -6.8e-208) {
		tmp = y / ((x + (y + 1.0)) * (y + x));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.2e+117:
		tmp = (1.0 / x) / ((y + x) / y)
	elif x <= -6.8e-208:
		tmp = y / ((x + (y + 1.0)) * (y + x))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.2e+117)
		tmp = Float64(Float64(1.0 / x) / Float64(Float64(y + x) / y));
	elseif (x <= -6.8e-208)
		tmp = Float64(y / Float64(Float64(x + Float64(y + 1.0)) * Float64(y + x)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.2e+117)
		tmp = (1.0 / x) / ((y + x) / y);
	elseif (x <= -6.8e-208)
		tmp = y / ((x + (y + 1.0)) * (y + x));
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.2e+117], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -6.8e-208], N[(y / N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.2 \cdot 10^{+117}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{y + x}{y}}\\

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{\left(x + \left(y + 1\right)\right) \cdot \left(y + x\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.1999999999999999e117

    1. Initial program 39.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*39.6%

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

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. times-frac71.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Step-by-step derivation
      1. *-commutative64.5%

        \[\leadsto \color{blue}{\frac{1}{x} \cdot \frac{y}{y + x}} \]
      2. clear-num64.5%

        \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{\frac{y + x}{y}}} \]
      3. un-div-inv64.5%

        \[\leadsto \color{blue}{\frac{\frac{1}{x}}{\frac{y + x}{y}}} \]
      4. +-commutative64.5%

        \[\leadsto \frac{\frac{1}{x}}{\frac{\color{blue}{x + y}}{y}} \]
    7. Applied egg-rr64.5%

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

    if -1.1999999999999999e117 < x < -6.8e-208

    1. Initial program 75.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*75.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot x}{\frac{x}{y} \cdot \left(\left(y + x\right) + \left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. *-un-lft-identity60.3%

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

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

        \[\leadsto \frac{x}{\frac{x}{y} \cdot \left(\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right)}\right)} \]
      6. *-un-lft-identity60.3%

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

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

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

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

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

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

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

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

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

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

    if -6.8e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 55.9%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified56.3%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/56.7%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv56.7%

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

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

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

Alternative 7: 85.5% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{\frac{y}{x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -7e-208)
   (/ (/ y x) (* (/ (+ x (+ y 1.0)) x) (+ y x)))
   (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -7e-208) {
		tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-7d-208)) then
        tmp = (y / x) / (((x + (y + 1.0d0)) / x) * (y + x))
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -7e-208) {
		tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -7e-208:
		tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -7e-208)
		tmp = Float64(Float64(y / x) / Float64(Float64(Float64(x + Float64(y + 1.0)) / x) * Float64(y + x)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -7e-208)
		tmp = (y / x) / (((x + (y + 1.0)) / x) * (y + x));
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -7e-208], N[(N[(y / x), $MachinePrecision] / N[(N[(N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{\frac{y}{x}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(y + x\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.99999999999999982e-208

    1. Initial program 61.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*61.1%

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

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

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

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

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(1 + \left(x + y\right)\right)}} \]
      6. distribute-lft-in88.5%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{x}{\left(y + x\right) + \left(x + y\right) \cdot \left(x + y\right)} \]
    8. Step-by-step derivation
      1. clear-num66.9%

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

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

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

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

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

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

        \[\leadsto \frac{y}{x \cdot \frac{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right)}}{x}} \]
      8. *-un-lft-identity72.8%

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

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

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

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

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

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

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

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

    if -6.99999999999999982e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 55.9%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified56.3%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/56.7%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv56.7%

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

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

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

Alternative 8: 79.2% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2.2 \cdot 10^{-172}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (* (/ y x) (/ 1.0 x))
   (if (<= x -2.2e-172) (/ y x) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2.2e-172) {
		tmp = y / x;
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-2.2d-172)) then
        tmp = y / x
    else
        tmp = x / (y * (y + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2.2e-172) {
		tmp = y / x;
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = (y / x) * (1.0 / x)
	elif x <= -2.2e-172:
		tmp = y / x
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (x <= -2.2e-172)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = (y / x) * (1.0 / x);
	elseif (x <= -2.2e-172)
		tmp = y / x;
	else
		tmp = x / (y * (y + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e-172], N[(y / x), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -2.2 \cdot 10^{-172}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 51.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*51.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around 0 54.9%

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

    if -1 < x < -2.20000000000000009e-172

    1. Initial program 72.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 49.8%

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

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

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified49.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 49.8%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -2.20000000000000009e-172 < x

    1. Initial program 66.3%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.7%

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

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

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

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

Alternative 9: 80.5% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (* (/ y x) (/ 1.0 x))
   (if (<= x -2.4e-172) (/ y x) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2.4e-172) {
		tmp = y / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-2.4d-172)) then
        tmp = y / x
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -2.4e-172) {
		tmp = y / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = (y / x) * (1.0 / x)
	elif x <= -2.4e-172:
		tmp = y / x
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (x <= -2.4e-172)
		tmp = Float64(y / x);
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = (y / x) * (1.0 / x);
	elseif (x <= -2.4e-172)
		tmp = y / x;
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.4e-172], N[(y / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -2.4 \cdot 10^{-172}:\\
\;\;\;\;\frac{y}{x}\\

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


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

    1. Initial program 51.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*51.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around 0 54.9%

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

    if -1 < x < -2.4000000000000001e-172

    1. Initial program 72.6%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 49.8%

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

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

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified49.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 49.8%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -2.4000000000000001e-172 < x

    1. Initial program 66.3%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.6%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified57.0%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/57.4%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv57.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 67.1% accurate, 1.3× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0) (* (/ y x) (/ 1.0 x)) (if (<= x -7e-208) (/ y x) (/ x y))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -7e-208) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-7d-208)) then
        tmp = y / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -7e-208) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.0:
		tmp = (y / x) * (1.0 / x)
	elif x <= -7e-208:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (x <= -7e-208)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = (y / x) * (1.0 / x);
	elseif (x <= -7e-208)
		tmp = y / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7e-208], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


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

    1. Initial program 51.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*51.2%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around 0 54.9%

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

    if -1 < x < -6.99999999999999982e-208

    1. Initial program 75.0%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 45.8%

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

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

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified45.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 45.8%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -6.99999999999999982e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.0%

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 30.7%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification37.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 81.6% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -2.4e-172) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.4e-172) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.4d-172)) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.4e-172) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.4e-172:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.4e-172)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.4e-172)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -2.4e-172], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-172}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4000000000000001e-172

    1. Initial program 59.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 55.8%

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

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative55.2%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified55.2%

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

    if -2.4000000000000001e-172 < x

    1. Initial program 66.3%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.6%

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

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

        \[\leadsto x \cdot \frac{\frac{1}{y}}{\color{blue}{y + 1}} \]
    7. Simplified57.0%

      \[\leadsto x \cdot \color{blue}{\frac{\frac{1}{y}}{y + 1}} \]
    8. Step-by-step derivation
      1. associate-*r/57.4%

        \[\leadsto \color{blue}{\frac{x \cdot \frac{1}{y}}{y + 1}} \]
      2. div-inv57.5%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-172}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 43.5% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -7e-208) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -7e-208) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-7d-208)) then
        tmp = y / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -7e-208) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -7e-208:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -7e-208)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -7e-208)
		tmp = y / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -7e-208], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.99999999999999982e-208

    1. Initial program 61.1%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 53.9%

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

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative53.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified53.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    8. Taylor expanded in x around 0 30.5%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -6.99999999999999982e-208 < x

    1. Initial program 65.7%

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.0%

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

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

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 30.7%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{-208}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 4.3% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 64.2%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*64.2%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
  6. Taylor expanded in y around inf 4.1%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  7. Final simplification4.1%

    \[\leadsto \frac{1}{x} \]
  8. Add Preprocessing

Alternative 14: 27.3% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
	return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x / y
end function
assert x < y;
public static double code(double x, double y) {
	return x / y;
}
[x, y] = sort([x, y])
def code(x, y):
	return x / y
x, y = sort([x, y])
function code(x, y)
	return Float64(x / y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 64.2%

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

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

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

    \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 51.6%

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

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

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  8. Taylor expanded in y around 0 25.9%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  9. Final simplification25.9%

    \[\leadsto \frac{x}{y} \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}

Reproduce

?
herbie shell --seed 2024115 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))