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

Percentage Accurate: 68.5% → 99.7%
Time: 17.2s
Alternatives: 24
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 24 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.5% 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: 99.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{y \cdot \left(\frac{1}{x + y} \cdot \frac{x}{x + y}\right)}{y - \left(-1 - x\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (* y (* (/ 1.0 (+ x y)) (/ x (+ x y)))) (- y (- -1.0 x))))
assert(x < y);
double code(double x, double y) {
	return (y * ((1.0 / (x + y)) * (x / (x + y)))) / (y - (-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 = (y * ((1.0d0 / (x + y)) * (x / (x + y)))) / (y - ((-1.0d0) - x))
end function
assert x < y;
public static double code(double x, double y) {
	return (y * ((1.0 / (x + y)) * (x / (x + y)))) / (y - (-1.0 - x));
}
[x, y] = sort([x, y])
def code(x, y):
	return (y * ((1.0 / (x + y)) * (x / (x + y)))) / (y - (-1.0 - x))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(y * Float64(Float64(1.0 / Float64(x + y)) * Float64(x / Float64(x + y)))) / Float64(y - Float64(-1.0 - x)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (y * ((1.0 / (x + y)) * (x / (x + y)))) / (y - (-1.0 - x));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(y * N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{y \cdot \left(\frac{1}{x + y} \cdot \frac{x}{x + y}\right)}{y - \left(-1 - x\right)}
\end{array}
Derivation
  1. Initial program 67.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.6%

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

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

    \[\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. Step-by-step derivation
    1. associate-*r/67.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{y \cdot \left(\frac{1}{x + y} \cdot \frac{x}{x + y}\right)}{y - \left(-1 - x\right)} \]
  10. Add Preprocessing

Alternative 2: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x + y}\\ \mathbf{if}\;x \leq -7 \cdot 10^{+17}:\\ \;\;\;\;\frac{t\_0}{x + y}\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;t\_0 \cdot \frac{-1}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \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 (/ y (+ x y))))
   (if (<= x -7e+17)
     (/ t_0 (+ x y))
     (if (<= x -5.2e-6)
       (/ (/ x (+ x y)) y)
       (if (<= x -2.6e-46)
         (/ y (* x (+ x 1.0)))
         (if (<= x -5.1e-101)
           (/ 1.0 (/ (* y (+ y 1.0)) x))
           (if (<= x -2.6e-109)
             (* t_0 (/ -1.0 (- -1.0 x)))
             (/ (/ x y) (- y (- -1.0 x))))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x + y);
	double tmp;
	if (x <= -7e+17) {
		tmp = t_0 / (x + y);
	} else if (x <= -5.2e-6) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.6e-46) {
		tmp = y / (x * (x + 1.0));
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0 * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	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 = y / (x + y)
    if (x <= (-7d+17)) then
        tmp = t_0 / (x + y)
    else if (x <= (-5.2d-6)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-2.6d-46)) then
        tmp = y / (x * (x + 1.0d0))
    else if (x <= (-5.1d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.6d-109)) then
        tmp = t_0 * ((-1.0d0) / ((-1.0d0) - x))
    else
        tmp = (x / y) / (y - ((-1.0d0) - x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x + y);
	double tmp;
	if (x <= -7e+17) {
		tmp = t_0 / (x + y);
	} else if (x <= -5.2e-6) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.6e-46) {
		tmp = y / (x * (x + 1.0));
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0 * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x + y)
	tmp = 0
	if x <= -7e+17:
		tmp = t_0 / (x + y)
	elif x <= -5.2e-6:
		tmp = (x / (x + y)) / y
	elif x <= -2.6e-46:
		tmp = y / (x * (x + 1.0))
	elif x <= -5.1e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.6e-109:
		tmp = t_0 * (-1.0 / (-1.0 - x))
	else:
		tmp = (x / y) / (y - (-1.0 - x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x + y))
	tmp = 0.0
	if (x <= -7e+17)
		tmp = Float64(t_0 / Float64(x + y));
	elseif (x <= -5.2e-6)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -2.6e-46)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	elseif (x <= -5.1e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.6e-109)
		tmp = Float64(t_0 * Float64(-1.0 / Float64(-1.0 - x)));
	else
		tmp = Float64(Float64(x / y) / Float64(y - Float64(-1.0 - x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x + y);
	tmp = 0.0;
	if (x <= -7e+17)
		tmp = t_0 / (x + y);
	elseif (x <= -5.2e-6)
		tmp = (x / (x + y)) / y;
	elseif (x <= -2.6e-46)
		tmp = y / (x * (x + 1.0));
	elseif (x <= -5.1e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.6e-109)
		tmp = t_0 * (-1.0 / (-1.0 - x));
	else
		tmp = (x / y) / (y - (-1.0 - x));
	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[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7e+17], N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.2e-6], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -2.6e-46], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.1e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-109], N[(t$95$0 * N[(-1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
\mathbf{if}\;x \leq -7 \cdot 10^{+17}:\\
\;\;\;\;\frac{t\_0}{x + y}\\

\mathbf{elif}\;x \leq -5.2 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\

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

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\
\;\;\;\;t\_0 \cdot \frac{-1}{-1 - x}\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Taylor expanded in x around inf 55.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\frac{y}{x + y}}{\color{blue}{\left(-x\right) + \left(-y\right)}} \]
      6. unsub-neg88.6%

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

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

    if -7e17 < x < -5.20000000000000019e-6

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.20000000000000019e-6 < x < -2.6000000000000002e-46

    1. Initial program 99.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. Step-by-step derivation
      1. associate-/l*99.6%

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

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

      \[\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 86.0%

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

    if -2.6000000000000002e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -5.1000000000000002e-101 < x < -2.5999999999999998e-109

    1. Initial program 99.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. *-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -7 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + y}\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{-1}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 81.5% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x + y}\\ t_1 := y - \left(-1 - x\right)\\ \mathbf{if}\;x \leq -1.85 \cdot 10^{+16}:\\ \;\;\;\;\frac{t\_0}{x + y}\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-9}:\\ \;\;\;\;\frac{\frac{-1}{-1 - y}}{\frac{x + y}{x}}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_1}\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;t\_0 \cdot \frac{-1}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t\_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 (/ y (+ x y))) (t_1 (- y (- -1.0 x))))
   (if (<= x -1.85e+16)
     (/ t_0 (+ x y))
     (if (<= x -1.75e-9)
       (/ (/ -1.0 (- -1.0 y)) (/ (+ x y) x))
       (if (<= x -1.9e-46)
         (/ (* y (/ 1.0 x)) t_1)
         (if (<= x -5.6e-101)
           (/ 1.0 (/ (* y (+ y 1.0)) x))
           (if (<= x -1.06e-109)
             (* t_0 (/ -1.0 (- -1.0 x)))
             (/ (/ x y) t_1))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x + y);
	double t_1 = y - (-1.0 - x);
	double tmp;
	if (x <= -1.85e+16) {
		tmp = t_0 / (x + y);
	} else if (x <= -1.75e-9) {
		tmp = (-1.0 / (-1.0 - y)) / ((x + y) / x);
	} else if (x <= -1.9e-46) {
		tmp = (y * (1.0 / x)) / t_1;
	} else if (x <= -5.6e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -1.06e-109) {
		tmp = t_0 * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / t_1;
	}
	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) :: t_1
    real(8) :: tmp
    t_0 = y / (x + y)
    t_1 = y - ((-1.0d0) - x)
    if (x <= (-1.85d+16)) then
        tmp = t_0 / (x + y)
    else if (x <= (-1.75d-9)) then
        tmp = ((-1.0d0) / ((-1.0d0) - y)) / ((x + y) / x)
    else if (x <= (-1.9d-46)) then
        tmp = (y * (1.0d0 / x)) / t_1
    else if (x <= (-5.6d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-1.06d-109)) then
        tmp = t_0 * ((-1.0d0) / ((-1.0d0) - x))
    else
        tmp = (x / y) / t_1
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x + y);
	double t_1 = y - (-1.0 - x);
	double tmp;
	if (x <= -1.85e+16) {
		tmp = t_0 / (x + y);
	} else if (x <= -1.75e-9) {
		tmp = (-1.0 / (-1.0 - y)) / ((x + y) / x);
	} else if (x <= -1.9e-46) {
		tmp = (y * (1.0 / x)) / t_1;
	} else if (x <= -5.6e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -1.06e-109) {
		tmp = t_0 * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / t_1;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x + y)
	t_1 = y - (-1.0 - x)
	tmp = 0
	if x <= -1.85e+16:
		tmp = t_0 / (x + y)
	elif x <= -1.75e-9:
		tmp = (-1.0 / (-1.0 - y)) / ((x + y) / x)
	elif x <= -1.9e-46:
		tmp = (y * (1.0 / x)) / t_1
	elif x <= -5.6e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -1.06e-109:
		tmp = t_0 * (-1.0 / (-1.0 - x))
	else:
		tmp = (x / y) / t_1
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x + y))
	t_1 = Float64(y - Float64(-1.0 - x))
	tmp = 0.0
	if (x <= -1.85e+16)
		tmp = Float64(t_0 / Float64(x + y));
	elseif (x <= -1.75e-9)
		tmp = Float64(Float64(-1.0 / Float64(-1.0 - y)) / Float64(Float64(x + y) / x));
	elseif (x <= -1.9e-46)
		tmp = Float64(Float64(y * Float64(1.0 / x)) / t_1);
	elseif (x <= -5.6e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -1.06e-109)
		tmp = Float64(t_0 * Float64(-1.0 / Float64(-1.0 - x)));
	else
		tmp = Float64(Float64(x / y) / t_1);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x + y);
	t_1 = y - (-1.0 - x);
	tmp = 0.0;
	if (x <= -1.85e+16)
		tmp = t_0 / (x + y);
	elseif (x <= -1.75e-9)
		tmp = (-1.0 / (-1.0 - y)) / ((x + y) / x);
	elseif (x <= -1.9e-46)
		tmp = (y * (1.0 / x)) / t_1;
	elseif (x <= -5.6e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -1.06e-109)
		tmp = t_0 * (-1.0 / (-1.0 - x));
	else
		tmp = (x / y) / t_1;
	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[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.85e+16], N[(t$95$0 / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.75e-9], N[(N[(-1.0 / N[(-1.0 - y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.9e-46], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[x, -5.6e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.06e-109], N[(t$95$0 * N[(-1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + y}\\
t_1 := y - \left(-1 - x\right)\\
\mathbf{if}\;x \leq -1.85 \cdot 10^{+16}:\\
\;\;\;\;\frac{t\_0}{x + y}\\

\mathbf{elif}\;x \leq -1.75 \cdot 10^{-9}:\\
\;\;\;\;\frac{\frac{-1}{-1 - y}}{\frac{x + y}{x}}\\

\mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_1}\\

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

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\
\;\;\;\;t\_0 \cdot \frac{-1}{-1 - x}\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Taylor expanded in x around inf 55.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{-\frac{y}{x + y}}{\color{blue}{\left(-x\right) + \left(-y\right)}} \]
      6. unsub-neg88.6%

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

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

    if -1.85e16 < x < -1.75e-9

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\frac{1}{1 + y}}}{\frac{x + y}{x}} \]
    8. Step-by-step derivation
      1. +-commutative60.6%

        \[\leadsto \frac{\frac{1}{\color{blue}{y + 1}}}{\frac{x + y}{x}} \]
    9. Simplified60.6%

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

    if -1.75e-9 < x < -1.8999999999999998e-46

    1. Initial program 99.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. Step-by-step derivation
      1. associate-/l*99.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999998e-46 < x < -5.59999999999999978e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -5.59999999999999978e-101 < x < -1.06e-109

    1. Initial program 99.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. *-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.06e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.85 \cdot 10^{+16}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{x + y}\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-9}:\\ \;\;\;\;\frac{\frac{-1}{-1 - y}}{\frac{x + y}{x}}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y - \left(-1 - x\right)}\\ \mathbf{elif}\;x \leq -5.6 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{-1}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -1.8e+18)
     (/ (/ 1.0 x) (/ (+ x y) y))
     (if (<= x -1.25e-10)
       (/ (/ x (+ x y)) y)
       (if (<= x -2.25e-46)
         t_0
         (if (<= x -5.2e-101)
           (/ 1.0 (/ (* y (+ y 1.0)) x))
           (if (<= x -2.6e-109) t_0 (/ (/ x y) (- y (- -1.0 x))))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.8e+18) {
		tmp = (1.0 / x) / ((x + y) / y);
	} else if (x <= -1.25e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.25e-46) {
		tmp = t_0;
	} else if (x <= -5.2e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	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 = y / (x * (x + 1.0d0))
    if (x <= (-1.8d+18)) then
        tmp = (1.0d0 / x) / ((x + y) / y)
    else if (x <= (-1.25d-10)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-2.25d-46)) then
        tmp = t_0
    else if (x <= (-5.2d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.6d-109)) then
        tmp = t_0
    else
        tmp = (x / y) / (y - ((-1.0d0) - x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.8e+18) {
		tmp = (1.0 / x) / ((x + y) / y);
	} else if (x <= -1.25e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.25e-46) {
		tmp = t_0;
	} else if (x <= -5.2e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -1.8e+18:
		tmp = (1.0 / x) / ((x + y) / y)
	elif x <= -1.25e-10:
		tmp = (x / (x + y)) / y
	elif x <= -2.25e-46:
		tmp = t_0
	elif x <= -5.2e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.6e-109:
		tmp = t_0
	else:
		tmp = (x / y) / (y - (-1.0 - x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -1.8e+18)
		tmp = Float64(Float64(1.0 / x) / Float64(Float64(x + y) / y));
	elseif (x <= -1.25e-10)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -2.25e-46)
		tmp = t_0;
	elseif (x <= -5.2e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / y) / Float64(y - Float64(-1.0 - x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -1.8e+18)
		tmp = (1.0 / x) / ((x + y) / y);
	elseif (x <= -1.25e-10)
		tmp = (x / (x + y)) / y;
	elseif (x <= -2.25e-46)
		tmp = t_0;
	elseif (x <= -5.2e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = (x / y) / (y - (-1.0 - x));
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e+18], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.25e-10], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -2.25e-46], t$95$0, If[LessEqual[x, -5.2e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-109], t$95$0, N[(N[(x / y), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\

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

\mathbf{elif}\;x \leq -2.25 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{\frac{x + y}{y}}} \]
      4. un-div-inv88.2%

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

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

    if -1.8e18 < x < -1.25000000000000008e-10

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000008e-10 < x < -2.25e-46 or -5.2000000000000002e-101 < x < -2.5999999999999998e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 y around 0 74.8%

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

    if -2.25e-46 < x < -5.2000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.2 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.0% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -9.5 \cdot 10^{+129}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -5.3 \cdot 10^{+14}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -1.36 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -9.5e+129)
     (* (/ 1.0 x) (/ y x))
     (if (<= x -5.3e+14)
       (/ y (* x (+ x y)))
       (if (<= x -1.36e-46)
         t_0
         (if (<= x -5.1e-101)
           (/ x (* y (+ y 1.0)))
           (if (<= x -1.06e-109) t_0 (/ (/ x (+ y 1.0)) y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -9.5e+129) {
		tmp = (1.0 / x) * (y / x);
	} else if (x <= -5.3e+14) {
		tmp = y / (x * (x + y));
	} else if (x <= -1.36e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (x <= (-9.5d+129)) then
        tmp = (1.0d0 / x) * (y / x)
    else if (x <= (-5.3d+14)) then
        tmp = y / (x * (x + y))
    else if (x <= (-1.36d-46)) then
        tmp = t_0
    else if (x <= (-5.1d-101)) then
        tmp = x / (y * (y + 1.0d0))
    else if (x <= (-1.06d-109)) then
        tmp = t_0
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -9.5e+129) {
		tmp = (1.0 / x) * (y / x);
	} else if (x <= -5.3e+14) {
		tmp = y / (x * (x + y));
	} else if (x <= -1.36e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -9.5e+129:
		tmp = (1.0 / x) * (y / x)
	elif x <= -5.3e+14:
		tmp = y / (x * (x + y))
	elif x <= -1.36e-46:
		tmp = t_0
	elif x <= -5.1e-101:
		tmp = x / (y * (y + 1.0))
	elif x <= -1.06e-109:
		tmp = t_0
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -9.5e+129)
		tmp = Float64(Float64(1.0 / x) * Float64(y / x));
	elseif (x <= -5.3e+14)
		tmp = Float64(y / Float64(x * Float64(x + y)));
	elseif (x <= -1.36e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -9.5e+129)
		tmp = (1.0 / x) * (y / x);
	elseif (x <= -5.3e+14)
		tmp = y / (x * (x + y));
	elseif (x <= -1.36e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = x / (y * (y + 1.0));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = (x / (y + 1.0)) / y;
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+129], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.3e+14], N[(y / N[(x * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.36e-46], t$95$0, If[LessEqual[x, -5.1e-101], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.06e-109], t$95$0, N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

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

\mathbf{elif}\;x \leq -1.36 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 50.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. *-commutative50.0%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000004e129 < x < -5.3e14

    1. Initial program 78.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative78.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.3e14 < x < -1.3600000000000001e-46 or -5.1000000000000002e-101 < x < -1.06e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 67.6%

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

    if -1.3600000000000001e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

    if -1.06e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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 64.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-un-lft-identity66.0%

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

        \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y} \]
    11. Applied egg-rr66.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.5 \cdot 10^{+129}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -5.3 \cdot 10^{+14}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + y\right)}\\ \mathbf{elif}\;x \leq -1.36 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -0.000106:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -1.8e+18)
     (/ (/ y x) (+ x y))
     (if (<= x -0.000106)
       (/ (/ x (+ x y)) y)
       (if (<= x -2.6e-46)
         t_0
         (if (<= x -5.1e-101)
           (/ x (* y (+ y 1.0)))
           (if (<= x -1.06e-109) t_0 (/ (/ x (+ y 1.0)) y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.8e+18) {
		tmp = (y / x) / (x + y);
	} else if (x <= -0.000106) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.6e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (x <= (-1.8d+18)) then
        tmp = (y / x) / (x + y)
    else if (x <= (-0.000106d0)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-2.6d-46)) then
        tmp = t_0
    else if (x <= (-5.1d-101)) then
        tmp = x / (y * (y + 1.0d0))
    else if (x <= (-1.06d-109)) then
        tmp = t_0
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.8e+18) {
		tmp = (y / x) / (x + y);
	} else if (x <= -0.000106) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.6e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -1.8e+18:
		tmp = (y / x) / (x + y)
	elif x <= -0.000106:
		tmp = (x / (x + y)) / y
	elif x <= -2.6e-46:
		tmp = t_0
	elif x <= -5.1e-101:
		tmp = x / (y * (y + 1.0))
	elif x <= -1.06e-109:
		tmp = t_0
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -1.8e+18)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif (x <= -0.000106)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -2.6e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -1.8e+18)
		tmp = (y / x) / (x + y);
	elseif (x <= -0.000106)
		tmp = (x / (x + y)) / y;
	elseif (x <= -2.6e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = x / (y * (y + 1.0));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = (x / (y + 1.0)) / y;
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e+18], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -0.000106], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -2.6e-46], t$95$0, If[LessEqual[x, -5.1e-101], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.06e-109], t$95$0, N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -0.000106:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e18 < x < -1.06e-4

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.06e-4 < x < -2.6000000000000002e-46 or -5.1000000000000002e-101 < x < -1.06e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 y around 0 74.8%

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

    if -2.6000000000000002e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

    if -1.06e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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 64.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-un-lft-identity66.0%

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

        \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y} \]
    11. Applied egg-rr66.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{+18}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -0.000106:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -1.25 \cdot 10^{+18}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-47}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -1.25e+18)
     (* (/ y (+ x y)) (/ 1.0 x))
     (if (<= x -3e-10)
       (/ (/ x (+ x y)) y)
       (if (<= x -6.8e-47)
         t_0
         (if (<= x -5.1e-101)
           (/ x (* y (+ y 1.0)))
           (if (<= x -1.06e-109) t_0 (/ (/ x (+ y 1.0)) y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.25e+18) {
		tmp = (y / (x + y)) * (1.0 / x);
	} else if (x <= -3e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -6.8e-47) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (x <= (-1.25d+18)) then
        tmp = (y / (x + y)) * (1.0d0 / x)
    else if (x <= (-3d-10)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-6.8d-47)) then
        tmp = t_0
    else if (x <= (-5.1d-101)) then
        tmp = x / (y * (y + 1.0d0))
    else if (x <= (-1.06d-109)) then
        tmp = t_0
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -1.25e+18) {
		tmp = (y / (x + y)) * (1.0 / x);
	} else if (x <= -3e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -6.8e-47) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = x / (y * (y + 1.0));
	} else if (x <= -1.06e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -1.25e+18:
		tmp = (y / (x + y)) * (1.0 / x)
	elif x <= -3e-10:
		tmp = (x / (x + y)) / y
	elif x <= -6.8e-47:
		tmp = t_0
	elif x <= -5.1e-101:
		tmp = x / (y * (y + 1.0))
	elif x <= -1.06e-109:
		tmp = t_0
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -1.25e+18)
		tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / x));
	elseif (x <= -3e-10)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -6.8e-47)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -1.25e+18)
		tmp = (y / (x + y)) * (1.0 / x);
	elseif (x <= -3e-10)
		tmp = (x / (x + y)) / y;
	elseif (x <= -6.8e-47)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = x / (y * (y + 1.0));
	elseif (x <= -1.06e-109)
		tmp = t_0;
	else
		tmp = (x / (y + 1.0)) / y;
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+18], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3e-10], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -6.8e-47], t$95$0, If[LessEqual[x, -5.1e-101], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.06e-109], t$95$0, N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+18}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\

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

\mathbf{elif}\;x \leq -6.8 \cdot 10^{-47}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

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

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

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

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

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

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

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

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

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

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

    if -1.25e18 < x < -3e-10

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3e-10 < x < -6.8000000000000003e-47 or -5.1000000000000002e-101 < x < -1.06e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 y around 0 74.8%

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

    if -6.8000000000000003e-47 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

    if -1.06e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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 64.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-un-lft-identity66.0%

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

        \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y} \]
    11. Applied egg-rr66.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+18}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -6.8 \cdot 10^{-47}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -1.06 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 81.4% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -9.2 \cdot 10^{+17}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -9.2e+17)
     (* (/ y (+ x y)) (/ 1.0 x))
     (if (<= x -1.7e-6)
       (/ (/ x (+ x y)) y)
       (if (<= x -1.9e-46)
         t_0
         (if (<= x -5.1e-101)
           (/ 1.0 (/ (* y (+ y 1.0)) x))
           (if (<= x -2.6e-109) t_0 (/ (/ x (+ y 1.0)) y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -9.2e+17) {
		tmp = (y / (x + y)) * (1.0 / x);
	} else if (x <= -1.7e-6) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -1.9e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (x <= (-9.2d+17)) then
        tmp = (y / (x + y)) * (1.0d0 / x)
    else if (x <= (-1.7d-6)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-1.9d-46)) then
        tmp = t_0
    else if (x <= (-5.1d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.6d-109)) then
        tmp = t_0
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -9.2e+17) {
		tmp = (y / (x + y)) * (1.0 / x);
	} else if (x <= -1.7e-6) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -1.9e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -9.2e+17:
		tmp = (y / (x + y)) * (1.0 / x)
	elif x <= -1.7e-6:
		tmp = (x / (x + y)) / y
	elif x <= -1.9e-46:
		tmp = t_0
	elif x <= -5.1e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.6e-109:
		tmp = t_0
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -9.2e+17)
		tmp = Float64(Float64(y / Float64(x + y)) * Float64(1.0 / x));
	elseif (x <= -1.7e-6)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -1.9e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -9.2e+17)
		tmp = (y / (x + y)) * (1.0 / x);
	elseif (x <= -1.7e-6)
		tmp = (x / (x + y)) / y;
	elseif (x <= -1.9e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = (x / (y + 1.0)) / y;
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.2e+17], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.7e-6], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -1.9e-46], t$95$0, If[LessEqual[x, -5.1e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-109], t$95$0, N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+17}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -1.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y}\\

\mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

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

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

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

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

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

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

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

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

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

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

    if -9.2e17 < x < -1.70000000000000003e-6

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.70000000000000003e-6 < x < -1.8999999999999998e-46 or -5.1000000000000002e-101 < x < -2.5999999999999998e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 y around 0 74.8%

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

    if -1.8999999999999998e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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 64.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-un-lft-identity66.0%

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

        \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y} \]
    11. Applied egg-rr66.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9.2 \cdot 10^{+17}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-6}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 81.3% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -2.8 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -1.85 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-100}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \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 (/ y (* x (+ x 1.0)))))
   (if (<= x -2.8e+17)
     (/ (/ 1.0 x) (/ (+ x y) y))
     (if (<= x -1.85e-10)
       (/ (/ x (+ x y)) y)
       (if (<= x -2.5e-46)
         t_0
         (if (<= x -3.8e-100)
           (/ 1.0 (/ (* y (+ y 1.0)) x))
           (if (<= x -2.6e-109) t_0 (/ (/ x (+ y 1.0)) y))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -2.8e+17) {
		tmp = (1.0 / x) / ((x + y) / y);
	} else if (x <= -1.85e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.5e-46) {
		tmp = t_0;
	} else if (x <= -3.8e-100) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / 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) :: t_0
    real(8) :: tmp
    t_0 = y / (x * (x + 1.0d0))
    if (x <= (-2.8d+17)) then
        tmp = (1.0d0 / x) / ((x + y) / y)
    else if (x <= (-1.85d-10)) then
        tmp = (x / (x + y)) / y
    else if (x <= (-2.5d-46)) then
        tmp = t_0
    else if (x <= (-3.8d-100)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.6d-109)) then
        tmp = t_0
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -2.8e+17) {
		tmp = (1.0 / x) / ((x + y) / y);
	} else if (x <= -1.85e-10) {
		tmp = (x / (x + y)) / y;
	} else if (x <= -2.5e-46) {
		tmp = t_0;
	} else if (x <= -3.8e-100) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = t_0;
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -2.8e+17:
		tmp = (1.0 / x) / ((x + y) / y)
	elif x <= -1.85e-10:
		tmp = (x / (x + y)) / y
	elif x <= -2.5e-46:
		tmp = t_0
	elif x <= -3.8e-100:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.6e-109:
		tmp = t_0
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -2.8e+17)
		tmp = Float64(Float64(1.0 / x) / Float64(Float64(x + y) / y));
	elseif (x <= -1.85e-10)
		tmp = Float64(Float64(x / Float64(x + y)) / y);
	elseif (x <= -2.5e-46)
		tmp = t_0;
	elseif (x <= -3.8e-100)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -2.8e+17)
		tmp = (1.0 / x) / ((x + y) / y);
	elseif (x <= -1.85e-10)
		tmp = (x / (x + y)) / y;
	elseif (x <= -2.5e-46)
		tmp = t_0;
	elseif (x <= -3.8e-100)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.6e-109)
		tmp = t_0;
	else
		tmp = (x / (y + 1.0)) / y;
	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[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.8e+17], N[(N[(1.0 / x), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.85e-10], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[x, -2.5e-46], t$95$0, If[LessEqual[x, -3.8e-100], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-109], t$95$0, N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -2.8 \cdot 10^{+17}:\\
\;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\

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

\mathbf{elif}\;x \leq -2.5 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


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

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{1}{\frac{x + y}{y}}} \]
      4. un-div-inv88.2%

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

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

    if -2.8e17 < x < -1.85000000000000007e-10

    1. Initial program 99.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative99.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.85000000000000007e-10 < x < -2.49999999999999996e-46 or -3.79999999999999997e-100 < x < -2.5999999999999998e-109

    1. Initial program 99.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*99.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+99.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. Simplified99.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 y around 0 74.8%

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

    if -2.49999999999999996e-46 < x < -3.79999999999999997e-100

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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 64.7%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-un-lft-identity66.0%

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

        \[\leadsto \frac{\frac{x}{\color{blue}{1 + y}}}{y} \]
    11. Applied egg-rr66.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.8 \cdot 10^{+17}:\\ \;\;\;\;\frac{\frac{1}{x}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -1.85 \cdot 10^{-10}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y}\\ \mathbf{elif}\;x \leq -2.5 \cdot 10^{-46}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-100}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 80.5% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+129}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46} \lor \neg \left(x \leq -1.4 \cdot 10^{-100}\right) \land x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \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 -5e+129)
   (* (/ 1.0 x) (/ y x))
   (if (or (<= x -2.6e-46) (and (not (<= x -1.4e-100)) (<= x -2.6e-109)))
     (/ y (* x (+ x 1.0)))
     (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+129) {
		tmp = (1.0 / x) * (y / x);
	} else if ((x <= -2.6e-46) || (!(x <= -1.4e-100) && (x <= -2.6e-109))) {
		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 <= (-5d+129)) then
        tmp = (1.0d0 / x) * (y / x)
    else if ((x <= (-2.6d-46)) .or. (.not. (x <= (-1.4d-100))) .and. (x <= (-2.6d-109))) 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 <= -5e+129) {
		tmp = (1.0 / x) * (y / x);
	} else if ((x <= -2.6e-46) || (!(x <= -1.4e-100) && (x <= -2.6e-109))) {
		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 <= -5e+129:
		tmp = (1.0 / x) * (y / x)
	elif (x <= -2.6e-46) or (not (x <= -1.4e-100) and (x <= -2.6e-109)):
		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 <= -5e+129)
		tmp = Float64(Float64(1.0 / x) * Float64(y / x));
	elseif ((x <= -2.6e-46) || (!(x <= -1.4e-100) && (x <= -2.6e-109)))
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	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 <= -5e+129)
		tmp = (1.0 / x) * (y / x);
	elseif ((x <= -2.6e-46) || (~((x <= -1.4e-100)) && (x <= -2.6e-109)))
		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, -5e+129], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -2.6e-46], And[N[Not[LessEqual[x, -1.4e-100]], $MachinePrecision], LessEqual[x, -2.6e-109]]], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $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 -5 \cdot 10^{+129}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-46} \lor \neg \left(x \leq -1.4 \cdot 10^{-100}\right) \land x \leq -2.6 \cdot 10^{-109}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

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


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

    1. Initial program 50.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. *-commutative50.0%

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

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000003e129 < x < -2.6000000000000002e-46 or -1.39999999999999998e-100 < x < -2.5999999999999998e-109

    1. Initial program 88.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*95.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+95.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. Simplified95.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 y around 0 66.1%

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

    if -2.6000000000000002e-46 < x < -1.39999999999999998e-100 or -2.5999999999999998e-109 < x

    1. Initial program 68.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*80.9%

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

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

      \[\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 66.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+129}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-46} \lor \neg \left(x \leq -1.4 \cdot 10^{-100}\right) \land x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 91.3% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.4 \cdot 10^{+103}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-177}:\\ \;\;\;\;x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{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 -3.4e+103)
   (/ (/ 1.0 (+ x y)) (/ (+ x y) y))
   (if (<= x -2.3e-177)
     (* x (/ y (* (* (+ x y) (+ x y)) (+ x (+ y 1.0)))))
     (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -3.4e+103) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else if (x <= -2.3e-177) {
		tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
	} else {
		tmp = (x / (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 <= (-3.4d+103)) then
        tmp = (1.0d0 / (x + y)) / ((x + y) / y)
    else if (x <= (-2.3d-177)) then
        tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0d0))))
    else
        tmp = (x / (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 <= -3.4e+103) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else if (x <= -2.3e-177) {
		tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -3.4e+103:
		tmp = (1.0 / (x + y)) / ((x + y) / y)
	elif x <= -2.3e-177:
		tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))))
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -3.4e+103)
		tmp = Float64(Float64(1.0 / Float64(x + y)) / Float64(Float64(x + y) / y));
	elseif (x <= -2.3e-177)
		tmp = Float64(x * Float64(y / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(x + Float64(y + 1.0)))));
	else
		tmp = Float64(Float64(x / 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 <= -3.4e+103)
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	elseif (x <= -2.3e-177)
		tmp = x * (y / (((x + y) * (x + y)) * (x + (y + 1.0))));
	else
		tmp = (x / (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, -3.4e+103], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.3e-177], N[(x * N[(y / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.4 \cdot 10^{+103}:\\
\;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\

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

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


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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
      4. *-un-lft-identity88.1%

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

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

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

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

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

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

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

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

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

    if -3.3999999999999998e103 < x < -2.30000000000000022e-177

    1. Initial program 90.5%

      \[\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*94.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+94.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. Simplified94.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 -2.30000000000000022e-177 < 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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative66.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    8. Step-by-step derivation
      1. +-commutative65.3%

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

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

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

Alternative 12: 82.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x + y} \cdot \frac{-1}{-1 - x}\\ \mathbf{if}\;x \leq -1.65 \cdot 10^{-46}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.3 \cdot 10^{-109}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y - \left(-1 - x\right)}\\ \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 (* (/ y (+ x y)) (/ -1.0 (- -1.0 x)))))
   (if (<= x -1.65e-46)
     t_0
     (if (<= x -5.1e-101)
       (/ 1.0 (/ (* y (+ y 1.0)) x))
       (if (<= x -2.3e-109) t_0 (/ (/ x y) (- y (- -1.0 x))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / (x + y)) * (-1.0 / (-1.0 - x));
	double tmp;
	if (x <= -1.65e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.3e-109) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	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 = (y / (x + y)) * ((-1.0d0) / ((-1.0d0) - x))
    if (x <= (-1.65d-46)) then
        tmp = t_0
    else if (x <= (-5.1d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.3d-109)) then
        tmp = t_0
    else
        tmp = (x / y) / (y - ((-1.0d0) - x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = (y / (x + y)) * (-1.0 / (-1.0 - x));
	double tmp;
	if (x <= -1.65e-46) {
		tmp = t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.3e-109) {
		tmp = t_0;
	} else {
		tmp = (x / y) / (y - (-1.0 - x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / (x + y)) * (-1.0 / (-1.0 - x))
	tmp = 0
	if x <= -1.65e-46:
		tmp = t_0
	elif x <= -5.1e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.3e-109:
		tmp = t_0
	else:
		tmp = (x / y) / (y - (-1.0 - x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / Float64(x + y)) * Float64(-1.0 / Float64(-1.0 - x)))
	tmp = 0.0
	if (x <= -1.65e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.3e-109)
		tmp = t_0;
	else
		tmp = Float64(Float64(x / y) / Float64(y - Float64(-1.0 - x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = (y / (x + y)) * (-1.0 / (-1.0 - x));
	tmp = 0.0;
	if (x <= -1.65e-46)
		tmp = t_0;
	elseif (x <= -5.1e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.3e-109)
		tmp = t_0;
	else
		tmp = (x / y) / (y - (-1.0 - x));
	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[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.65e-46], t$95$0, If[LessEqual[x, -5.1e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.3e-109], t$95$0, N[(N[(x / y), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x + y} \cdot \frac{-1}{-1 - x}\\
\mathbf{if}\;x \leq -1.65 \cdot 10^{-46}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -2.3 \cdot 10^{-109}:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.65000000000000007e-46 or -5.1000000000000002e-101 < x < -2.3000000000000001e-109

    1. Initial program 63.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.65000000000000007e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 82.2% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y - \left(-1 - x\right)\\ \mathbf{if}\;x \leq -2.6 \cdot 10^{-46}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_0}\\ \mathbf{elif}\;x \leq -5.1 \cdot 10^{-101}:\\ \;\;\;\;\frac{1}{\frac{y \cdot \left(y + 1\right)}{x}}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{-1}{-1 - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{t\_0}\\ \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 (- y (- -1.0 x))))
   (if (<= x -2.6e-46)
     (/ (* y (/ 1.0 x)) t_0)
     (if (<= x -5.1e-101)
       (/ 1.0 (/ (* y (+ y 1.0)) x))
       (if (<= x -2.6e-109)
         (* (/ y (+ x y)) (/ -1.0 (- -1.0 x)))
         (/ (/ x y) t_0))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (x <= -2.6e-46) {
		tmp = (y * (1.0 / x)) / t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = (y / (x + y)) * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / t_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 = y - ((-1.0d0) - x)
    if (x <= (-2.6d-46)) then
        tmp = (y * (1.0d0 / x)) / t_0
    else if (x <= (-5.1d-101)) then
        tmp = 1.0d0 / ((y * (y + 1.0d0)) / x)
    else if (x <= (-2.6d-109)) then
        tmp = (y / (x + y)) * ((-1.0d0) / ((-1.0d0) - x))
    else
        tmp = (x / y) / t_0
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (x <= -2.6e-46) {
		tmp = (y * (1.0 / x)) / t_0;
	} else if (x <= -5.1e-101) {
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	} else if (x <= -2.6e-109) {
		tmp = (y / (x + y)) * (-1.0 / (-1.0 - x));
	} else {
		tmp = (x / y) / t_0;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y - (-1.0 - x)
	tmp = 0
	if x <= -2.6e-46:
		tmp = (y * (1.0 / x)) / t_0
	elif x <= -5.1e-101:
		tmp = 1.0 / ((y * (y + 1.0)) / x)
	elif x <= -2.6e-109:
		tmp = (y / (x + y)) * (-1.0 / (-1.0 - x))
	else:
		tmp = (x / y) / t_0
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y - Float64(-1.0 - x))
	tmp = 0.0
	if (x <= -2.6e-46)
		tmp = Float64(Float64(y * Float64(1.0 / x)) / t_0);
	elseif (x <= -5.1e-101)
		tmp = Float64(1.0 / Float64(Float64(y * Float64(y + 1.0)) / x));
	elseif (x <= -2.6e-109)
		tmp = Float64(Float64(y / Float64(x + y)) * Float64(-1.0 / Float64(-1.0 - x)));
	else
		tmp = Float64(Float64(x / y) / t_0);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y - (-1.0 - x);
	tmp = 0.0;
	if (x <= -2.6e-46)
		tmp = (y * (1.0 / x)) / t_0;
	elseif (x <= -5.1e-101)
		tmp = 1.0 / ((y * (y + 1.0)) / x);
	elseif (x <= -2.6e-109)
		tmp = (y / (x + y)) * (-1.0 / (-1.0 - x));
	else
		tmp = (x / y) / t_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[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.6e-46], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[x, -5.1e-101], N[(1.0 / N[(N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.6e-109], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y - \left(-1 - x\right)\\
\mathbf{if}\;x \leq -2.6 \cdot 10^{-46}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_0}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.6000000000000002e-46

    1. Initial program 62.9%

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

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/62.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6000000000000002e-46 < x < -5.1000000000000002e-101

    1. Initial program 87.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*88.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+88.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. Simplified88.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 92.6%

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

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

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

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

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

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

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

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

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

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

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

    if -5.1000000000000002e-101 < x < -2.5999999999999998e-109

    1. Initial program 99.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. *-commutative99.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5999999999999998e-109 < x

    1. Initial program 67.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. Step-by-step derivation
      1. associate-/l*80.6%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 85.6% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.02 \cdot 10^{+93}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{elif}\;x \leq -2.7 \cdot 10^{-120}:\\ \;\;\;\;\frac{x \cdot y}{\left(x + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{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.02e+93)
   (/ (/ 1.0 (+ x y)) (/ (+ x y) y))
   (if (<= x -2.7e-120)
     (/ (* x y) (* (+ x 1.0) (* (+ x y) (+ x y))))
     (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.02e+93) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else if (x <= -2.7e-120) {
		tmp = (x * y) / ((x + 1.0) * ((x + y) * (x + y)));
	} else {
		tmp = (x / (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.02d+93)) then
        tmp = (1.0d0 / (x + y)) / ((x + y) / y)
    else if (x <= (-2.7d-120)) then
        tmp = (x * y) / ((x + 1.0d0) * ((x + y) * (x + y)))
    else
        tmp = (x / (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.02e+93) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else if (x <= -2.7e-120) {
		tmp = (x * y) / ((x + 1.0) * ((x + y) * (x + y)));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.02e+93:
		tmp = (1.0 / (x + y)) / ((x + y) / y)
	elif x <= -2.7e-120:
		tmp = (x * y) / ((x + 1.0) * ((x + y) * (x + y)))
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.02e+93)
		tmp = Float64(Float64(1.0 / Float64(x + y)) / Float64(Float64(x + y) / y));
	elseif (x <= -2.7e-120)
		tmp = Float64(Float64(x * y) / Float64(Float64(x + 1.0) * Float64(Float64(x + y) * Float64(x + y))));
	else
		tmp = Float64(Float64(x / 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.02e+93)
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	elseif (x <= -2.7e-120)
		tmp = (x * y) / ((x + 1.0) * ((x + y) * (x + y)));
	else
		tmp = (x / (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.02e+93], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.7e-120], N[(N[(x * y), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.02 \cdot 10^{+93}:\\
\;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\

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

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


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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
      4. *-un-lft-identity85.9%

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

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
    8. Step-by-step derivation
      1. div-inv86.0%

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

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

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

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

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

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

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

    if -1.0200000000000001e93 < x < -2.6999999999999999e-120

    1. Initial program 93.5%

      \[\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. Taylor expanded in y around 0 76.4%

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

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

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

    if -2.6999999999999999e-120 < x

    1. Initial program 67.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative67.3%

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

        \[\leadsto \frac{y \cdot x}{\color{blue}{\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}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+96.1%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    8. Step-by-step derivation
      1. +-commutative66.3%

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

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

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

Alternative 15: 86.2% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -60000000:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y - \left(-1 - x\right)}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{-159}:\\ \;\;\;\;\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{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 -60000000.0)
   (/ (* y (/ 1.0 x)) (- y (- -1.0 x)))
   (if (<= x -5e-159)
     (/ (* x y) (* (* (+ x y) (+ x y)) (+ y 1.0)))
     (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -60000000.0) {
		tmp = (y * (1.0 / x)) / (y - (-1.0 - x));
	} else if (x <= -5e-159) {
		tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
	} else {
		tmp = (x / (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 <= (-60000000.0d0)) then
        tmp = (y * (1.0d0 / x)) / (y - ((-1.0d0) - x))
    else if (x <= (-5d-159)) then
        tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0d0))
    else
        tmp = (x / (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 <= -60000000.0) {
		tmp = (y * (1.0 / x)) / (y - (-1.0 - x));
	} else if (x <= -5e-159) {
		tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -60000000.0:
		tmp = (y * (1.0 / x)) / (y - (-1.0 - x))
	elif x <= -5e-159:
		tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0))
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -60000000.0)
		tmp = Float64(Float64(y * Float64(1.0 / x)) / Float64(y - Float64(-1.0 - x)));
	elseif (x <= -5e-159)
		tmp = Float64(Float64(x * y) / Float64(Float64(Float64(x + y) * Float64(x + y)) * Float64(y + 1.0)));
	else
		tmp = Float64(Float64(x / 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 <= -60000000.0)
		tmp = (y * (1.0 / x)) / (y - (-1.0 - x));
	elseif (x <= -5e-159)
		tmp = (x * y) / (((x + y) * (x + y)) * (y + 1.0));
	else
		tmp = (x / (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, -60000000.0], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e-159], N[(N[(x * y), $MachinePrecision] / N[(N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -60000000:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{y - \left(-1 - x\right)}\\

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

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


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

    1. Initial program 57.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*72.4%

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

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

      \[\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. Step-by-step derivation
      1. associate-*r/57.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6e7 < x < -5.00000000000000032e-159

    1. Initial program 96.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. Taylor expanded in x around 0 95.4%

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

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

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

    if -5.00000000000000032e-159 < x

    1. Initial program 66.5%

      \[\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. *-commutative66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    8. Step-by-step derivation
      1. +-commutative65.5%

        \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    9. Simplified65.5%

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

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

Alternative 16: 95.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{+156}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\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 -4.3e+156)
   (/ (/ 1.0 (+ x y)) (/ (+ x y) y))
   (* (/ x (+ x y)) (/ y (* (+ x y) (- y (- -1.0 x)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -4.3e+156) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else {
		tmp = (x / (x + y)) * (y / ((x + y) * (y - (-1.0 - x))));
	}
	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 <= (-4.3d+156)) then
        tmp = (1.0d0 / (x + y)) / ((x + y) / y)
    else
        tmp = (x / (x + y)) * (y / ((x + y) * (y - ((-1.0d0) - x))))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -4.3e+156) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else {
		tmp = (x / (x + y)) * (y / ((x + y) * (y - (-1.0 - x))));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -4.3e+156:
		tmp = (1.0 / (x + y)) / ((x + y) / y)
	else:
		tmp = (x / (x + y)) * (y / ((x + y) * (y - (-1.0 - x))))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -4.3e+156)
		tmp = Float64(Float64(1.0 / Float64(x + y)) / Float64(Float64(x + y) / y));
	else
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * Float64(y - Float64(-1.0 - x)))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -4.3e+156)
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	else
		tmp = (x / (x + y)) * (y / ((x + y) * (y - (-1.0 - x))));
	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, -4.3e+156], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{+156}:\\
\;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\

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


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

    1. Initial program 49.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. Add Preprocessing
    3. Taylor expanded in x around inf 49.4%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
      4. *-un-lft-identity85.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + y}{y} \cdot x} \]
    7. Applied egg-rr85.8%

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

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

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

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

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

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

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

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

    if -4.29999999999999985e156 < x

    1. Initial program 70.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*70.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. times-frac96.8%

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

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

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      5. associate-+r+96.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative96.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      7. associate-+l+96.8%

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr96.8%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.3 \cdot 10^{+156}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 95.8% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.65 \cdot 10^{+155}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\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 -2.65e+155)
   (/ (/ 1.0 (+ x y)) (/ (+ x y) y))
   (* (/ y (+ x y)) (/ x (* (+ x y) (- y (- -1.0 x)))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.65e+155) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else {
		tmp = (y / (x + y)) * (x / ((x + y) * (y - (-1.0 - x))));
	}
	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.65d+155)) then
        tmp = (1.0d0 / (x + y)) / ((x + y) / y)
    else
        tmp = (y / (x + y)) * (x / ((x + y) * (y - ((-1.0d0) - x))))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.65e+155) {
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	} else {
		tmp = (y / (x + y)) * (x / ((x + y) * (y - (-1.0 - x))));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.65e+155:
		tmp = (1.0 / (x + y)) / ((x + y) / y)
	else:
		tmp = (y / (x + y)) * (x / ((x + y) * (y - (-1.0 - x))))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.65e+155)
		tmp = Float64(Float64(1.0 / Float64(x + y)) / Float64(Float64(x + y) / y));
	else
		tmp = Float64(Float64(y / Float64(x + y)) * Float64(x / Float64(Float64(x + y) * Float64(y - Float64(-1.0 - x)))));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.65e+155)
		tmp = (1.0 / (x + y)) / ((x + y) / y);
	else
		tmp = (y / (x + y)) * (x / ((x + y) * (y - (-1.0 - x))));
	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.65e+155], N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(x / N[(N[(x + y), $MachinePrecision] * N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.65 \cdot 10^{+155}:\\
\;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.64999999999999982e155

    1. Initial program 49.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. Add Preprocessing
    3. Taylor expanded in x around inf 49.4%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{x}} \]
    4. Step-by-step derivation
      1. *-commutative49.4%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot x} \]
      2. associate-*l*49.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot x\right)}} \]
      3. +-commutative49.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot x\right)} \]
      4. times-frac68.6%

        \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(x + y\right) \cdot x}} \]
      5. +-commutative68.6%

        \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{x}{\left(x + y\right) \cdot x} \]
    5. Applied egg-rr68.6%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot x}} \]
    6. Step-by-step derivation
      1. clear-num68.6%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot x} \]
      2. associate-/r*91.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x}} \]
      3. frac-times85.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
      4. *-un-lft-identity85.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{x + y}{y} \cdot x} \]
    7. Applied egg-rr85.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot x}} \]
    8. Step-by-step derivation
      1. div-inv85.8%

        \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{x + y}}}{\frac{x + y}{y} \cdot x} \]
      2. *-commutative85.8%

        \[\leadsto \frac{x \cdot \frac{1}{x + y}}{\color{blue}{x \cdot \frac{x + y}{y}}} \]
      3. times-frac91.9%

        \[\leadsto \color{blue}{\frac{x}{x} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}}} \]
    9. Applied egg-rr91.9%

      \[\leadsto \color{blue}{\frac{x}{x} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}}} \]
    10. Step-by-step derivation
      1. *-inverses91.9%

        \[\leadsto \color{blue}{1} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}} \]
      2. associate-*r/91.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{x + y}}{\frac{x + y}{y}}} \]
    11. Simplified91.9%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{1}{x + y}}{\frac{x + y}{y}}} \]

    if -2.64999999999999982e155 < x

    1. Initial program 70.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. *-commutative70.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*70.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac96.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative96.9%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative96.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+96.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative96.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+96.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr96.9%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification96.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.65 \cdot 10^{+155}:\\ \;\;\;\;\frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{x}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \left(\frac{x}{y} + 1\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (/ x (+ x y)) (* (- y (- -1.0 x)) (+ (/ x y) 1.0))))
assert(x < y);
double code(double x, double y) {
	return (x / (x + y)) / ((y - (-1.0 - x)) * ((x / y) + 1.0));
}
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 / (x + y)) / ((y - ((-1.0d0) - x)) * ((x / y) + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
	return (x / (x + y)) / ((y - (-1.0 - x)) * ((x / y) + 1.0));
}
[x, y] = sort([x, y])
def code(x, y):
	return (x / (x + y)) / ((y - (-1.0 - x)) * ((x / y) + 1.0))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(x / Float64(x + y)) / Float64(Float64(y - Float64(-1.0 - x)) * Float64(Float64(x / y) + 1.0)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (x / (x + y)) / ((y - (-1.0 - x)) * ((x / y) + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \left(\frac{x}{y} + 1\right)}
\end{array}
Derivation
  1. Initial program 67.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. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative67.3%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. associate-*l*67.3%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    3. times-frac92.5%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    4. +-commutative92.5%

      \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    5. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
    6. associate-+r+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    7. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
    8. associate-+l+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
  4. Applied egg-rr92.5%

    \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  5. Step-by-step derivation
    1. clear-num92.5%

      \[\leadsto \color{blue}{\frac{1}{\frac{y + x}{y}}} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
    2. associate-/r*99.8%

      \[\leadsto \frac{1}{\frac{y + x}{y}} \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}} \]
    3. frac-times98.3%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(1 + x\right)\right)}} \]
    4. *-un-lft-identity98.3%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + x}}}{\frac{y + x}{y} \cdot \left(y + \left(1 + x\right)\right)} \]
    5. +-commutative98.3%

      \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{y + x}{y} \cdot \left(y + \left(1 + x\right)\right)} \]
    6. +-commutative98.3%

      \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + y}}{y} \cdot \left(y + \left(1 + x\right)\right)} \]
    7. +-commutative98.3%

      \[\leadsto \frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(y + \color{blue}{\left(x + 1\right)}\right)} \]
  6. Applied egg-rr98.3%

    \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
  7. Taylor expanded in x around 0 98.4%

    \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{\left(1 + \frac{x}{y}\right)} \cdot \left(y + \left(x + 1\right)\right)} \]
  8. Final simplification98.4%

    \[\leadsto \frac{\frac{x}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \left(\frac{x}{y} + 1\right)} \]
  9. Add Preprocessing

Alternative 19: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{y}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \frac{x + y}{x}} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (/ y (+ x y)) (* (- y (- -1.0 x)) (/ (+ x y) x))))
assert(x < y);
double code(double x, double y) {
	return (y / (x + y)) / ((y - (-1.0 - x)) * ((x + y) / 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 = (y / (x + y)) / ((y - ((-1.0d0) - x)) * ((x + y) / x))
end function
assert x < y;
public static double code(double x, double y) {
	return (y / (x + y)) / ((y - (-1.0 - x)) * ((x + y) / x));
}
[x, y] = sort([x, y])
def code(x, y):
	return (y / (x + y)) / ((y - (-1.0 - x)) * ((x + y) / x))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(y / Float64(x + y)) / Float64(Float64(y - Float64(-1.0 - x)) * Float64(Float64(x + y) / x)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (y / (x + y)) / ((y - (-1.0 - x)) * ((x + y) / x));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(N[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \frac{x + y}{x}}
\end{array}
Derivation
  1. Initial program 67.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. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative67.3%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. associate-*l*67.3%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    3. times-frac92.5%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    4. +-commutative92.5%

      \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    5. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
    6. associate-+r+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    7. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
    8. associate-+l+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
  4. Applied egg-rr92.5%

    \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  5. Step-by-step derivation
    1. frac-times67.3%

      \[\leadsto \color{blue}{\frac{y \cdot x}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)\right)}} \]
    2. *-commutative67.3%

      \[\leadsto \frac{\color{blue}{x \cdot y}}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)\right)} \]
    3. frac-times92.4%

      \[\leadsto \color{blue}{\frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    4. clear-num92.4%

      \[\leadsto \color{blue}{\frac{1}{\frac{y + x}{x}}} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
    5. associate-/r*99.7%

      \[\leadsto \frac{1}{\frac{y + x}{x}} \cdot \color{blue}{\frac{\frac{y}{y + x}}{y + \left(1 + x\right)}} \]
    6. frac-times99.6%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{y + x}}{\frac{y + x}{x} \cdot \left(y + \left(1 + x\right)\right)}} \]
    7. *-un-lft-identity99.6%

      \[\leadsto \frac{\color{blue}{\frac{y}{y + x}}}{\frac{y + x}{x} \cdot \left(y + \left(1 + x\right)\right)} \]
    8. +-commutative99.6%

      \[\leadsto \frac{\frac{y}{\color{blue}{x + y}}}{\frac{y + x}{x} \cdot \left(y + \left(1 + x\right)\right)} \]
    9. +-commutative99.6%

      \[\leadsto \frac{\frac{y}{x + y}}{\frac{\color{blue}{x + y}}{x} \cdot \left(y + \left(1 + x\right)\right)} \]
    10. +-commutative99.6%

      \[\leadsto \frac{\frac{y}{x + y}}{\frac{x + y}{x} \cdot \left(y + \color{blue}{\left(x + 1\right)}\right)} \]
  6. Applied egg-rr99.6%

    \[\leadsto \color{blue}{\frac{\frac{y}{x + y}}{\frac{x + y}{x} \cdot \left(y + \left(x + 1\right)\right)}} \]
  7. Final simplification99.6%

    \[\leadsto \frac{\frac{y}{x + y}}{\left(y - \left(-1 - x\right)\right) \cdot \frac{x + y}{x}} \]
  8. Add Preprocessing

Alternative 20: 85.5% accurate, 1.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y - \left(-1 - x\right)\\ \mathbf{if}\;y \leq 1.7 \cdot 10^{-149}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot t\_0}\\ \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 (- y (- -1.0 x))))
   (if (<= y 1.7e-149) (/ (* y (/ 1.0 x)) t_0) (/ x (* (+ x y) t_0)))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (y <= 1.7e-149) {
		tmp = (y * (1.0 / x)) / t_0;
	} else {
		tmp = x / ((x + y) * t_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 = y - ((-1.0d0) - x)
    if (y <= 1.7d-149) then
        tmp = (y * (1.0d0 / x)) / t_0
    else
        tmp = x / ((x + y) * t_0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y - (-1.0 - x);
	double tmp;
	if (y <= 1.7e-149) {
		tmp = (y * (1.0 / x)) / t_0;
	} else {
		tmp = x / ((x + y) * t_0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y - (-1.0 - x)
	tmp = 0
	if y <= 1.7e-149:
		tmp = (y * (1.0 / x)) / t_0
	else:
		tmp = x / ((x + y) * t_0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y - Float64(-1.0 - x))
	tmp = 0.0
	if (y <= 1.7e-149)
		tmp = Float64(Float64(y * Float64(1.0 / x)) / t_0);
	else
		tmp = Float64(x / Float64(Float64(x + y) * t_0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y - (-1.0 - x);
	tmp = 0.0;
	if (y <= 1.7e-149)
		tmp = (y * (1.0 / x)) / t_0;
	else
		tmp = x / ((x + y) * t_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[(y - N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 1.7e-149], N[(N[(y * N[(1.0 / x), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(x / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y - \left(-1 - x\right)\\
\mathbf{if}\;y \leq 1.7 \cdot 10^{-149}:\\
\;\;\;\;\frac{y \cdot \frac{1}{x}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot t\_0}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.6999999999999999e-149

    1. Initial program 63.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*75.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+75.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. Simplified75.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. Step-by-step derivation
      1. associate-*r/63.2%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      2. associate-+r+63.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(\left(x + y\right) + 1\right)}} \]
      3. times-frac82.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      4. associate-*r/82.6%

        \[\leadsto \color{blue}{\frac{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot y}{\left(x + y\right) + 1}} \]
      5. pow282.6%

        \[\leadsto \frac{\frac{x}{\color{blue}{{\left(x + y\right)}^{2}}} \cdot y}{\left(x + y\right) + 1} \]
      6. +-commutative82.6%

        \[\leadsto \frac{\frac{x}{{\color{blue}{\left(y + x\right)}}^{2}} \cdot y}{\left(x + y\right) + 1} \]
      7. associate-+r+82.6%

        \[\leadsto \frac{\frac{x}{{\left(y + x\right)}^{2}} \cdot y}{\color{blue}{x + \left(y + 1\right)}} \]
      8. +-commutative82.6%

        \[\leadsto \frac{\frac{x}{{\left(y + x\right)}^{2}} \cdot y}{\color{blue}{\left(y + 1\right) + x}} \]
      9. associate-+l+82.6%

        \[\leadsto \frac{\frac{x}{{\left(y + x\right)}^{2}} \cdot y}{\color{blue}{y + \left(1 + x\right)}} \]
    6. Applied egg-rr82.6%

      \[\leadsto \color{blue}{\frac{\frac{x}{{\left(y + x\right)}^{2}} \cdot y}{y + \left(1 + x\right)}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity82.6%

        \[\leadsto \frac{\frac{\color{blue}{1 \cdot x}}{{\left(y + x\right)}^{2}} \cdot y}{y + \left(1 + x\right)} \]
      2. unpow282.6%

        \[\leadsto \frac{\frac{1 \cdot x}{\color{blue}{\left(y + x\right) \cdot \left(y + x\right)}} \cdot y}{y + \left(1 + x\right)} \]
      3. times-frac99.7%

        \[\leadsto \frac{\color{blue}{\left(\frac{1}{y + x} \cdot \frac{x}{y + x}\right)} \cdot y}{y + \left(1 + x\right)} \]
      4. +-commutative99.7%

        \[\leadsto \frac{\left(\frac{1}{\color{blue}{x + y}} \cdot \frac{x}{y + x}\right) \cdot y}{y + \left(1 + x\right)} \]
      5. +-commutative99.7%

        \[\leadsto \frac{\left(\frac{1}{x + y} \cdot \frac{x}{\color{blue}{x + y}}\right) \cdot y}{y + \left(1 + x\right)} \]
    8. Applied egg-rr99.7%

      \[\leadsto \frac{\color{blue}{\left(\frac{1}{x + y} \cdot \frac{x}{x + y}\right)} \cdot y}{y + \left(1 + x\right)} \]
    9. Taylor expanded in x around inf 56.2%

      \[\leadsto \frac{\color{blue}{\frac{1}{x}} \cdot y}{y + \left(1 + x\right)} \]

    if 1.6999999999999999e-149 < y

    1. Initial program 73.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. *-commutative73.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*73.9%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac93.4%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative93.4%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative93.4%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+93.4%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative93.4%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+93.4%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr93.4%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in y around inf 79.4%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.7 \cdot 10^{-149}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y - \left(-1 - x\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(y - \left(-1 - x\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 61.8% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -60000000:\\ \;\;\;\;\frac{1}{x} \cdot \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 -60000000.0) (* (/ 1.0 x) (/ y x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -60000000.0) {
		tmp = (1.0 / x) * (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 <= (-60000000.0d0)) then
        tmp = (1.0d0 / x) * (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 <= -60000000.0) {
		tmp = (1.0 / x) * (y / x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -60000000.0:
		tmp = (1.0 / x) * (y / x)
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -60000000.0)
		tmp = Float64(Float64(1.0 / x) * 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 <= -60000000.0)
		tmp = (1.0 / x) * (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, -60000000.0], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -60000000:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6e7

    1. Initial program 57.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative57.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*57.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac80.2%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative80.2%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative80.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+80.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative80.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+80.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr80.2%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in x around inf 86.5%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around 0 86.3%

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]

    if -6e7 < x

    1. Initial program 70.5%

      \[\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*82.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+82.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. Simplified82.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 64.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative64.4%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified64.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 42.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification53.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -60000000:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 22: 78.7% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+17}:\\ \;\;\;\;\frac{1}{x} \cdot \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 -2.9e+17) (* (/ 1.0 x) (/ y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.9e+17) {
		tmp = (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 <= (-2.9d+17)) then
        tmp = (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 <= -2.9e+17) {
		tmp = (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 <= -2.9e+17:
		tmp = (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 <= -2.9e+17)
		tmp = Float64(Float64(1.0 / x) * 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 <= -2.9e+17)
		tmp = (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, -2.9e+17], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $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 -2.9 \cdot 10^{+17}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.9e17

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*55.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac79.2%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative79.2%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr79.2%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in x around inf 88.1%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around 0 88.0%

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]

    if -2.9e17 < x

    1. Initial program 70.9%

      \[\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*82.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+82.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. Simplified82.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 x around 0 64.0%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative64.0%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified64.0%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification69.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+17}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 28.1% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.85 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{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 -2.85e+18) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.85e+18) {
		tmp = 1.0 / 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 <= (-2.85d+18)) then
        tmp = 1.0d0 / 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 <= -2.85e+18) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.85e+18:
		tmp = 1.0 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.85e+18)
		tmp = Float64(1.0 / 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 <= -2.85e+18)
		tmp = 1.0 / 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, -2.85e+18], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.85 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.85e18

    1. Initial program 55.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. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative55.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*55.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac79.2%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative79.2%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+79.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr79.2%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in x around inf 88.1%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
    6. Taylor expanded in y around inf 6.2%

      \[\leadsto \color{blue}{\frac{1}{x}} \]

    if -2.85e18 < x

    1. Initial program 70.9%

      \[\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*82.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+82.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. Simplified82.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 x around 0 64.0%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative64.0%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified64.0%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 41.8%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.85 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 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 67.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. Add Preprocessing
  3. Step-by-step derivation
    1. *-commutative67.3%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. associate-*l*67.3%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    3. times-frac92.5%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    4. +-commutative92.5%

      \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    5. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
    6. associate-+r+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    7. +-commutative92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
    8. associate-+l+92.5%

      \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
  4. Applied egg-rr92.5%

    \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  5. Taylor expanded in x around inf 38.6%

    \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x}} \]
  6. Taylor expanded in y around inf 4.3%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  7. Final simplification4.3%

    \[\leadsto \frac{1}{x} \]
  8. 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 2024078 
(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))))