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

Percentage Accurate: 68.8% → 99.8%
Time: 21.2s
Alternatives: 21
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 21 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.8% 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.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 96.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 40.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-+r+40.6%

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999963e74 < x < -0.00619999999999999978

    1. Initial program 81.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. times-frac95.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult95.4%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. fma-udef81.8%

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

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

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

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

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

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

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

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

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

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

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

    if -0.00619999999999999978 < x

    1. Initial program 73.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. times-frac90.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult85.3%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative85.3%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified85.3%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 89.1% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -8.2 \cdot 10^{-156}:\\ \;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\ \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+164)
   (* (/ y (+ y x)) (/ 1.0 x))
   (if (<= x -8.2e-156)
     (* (/ y (* (+ y x) (+ y x))) (/ x (+ x 1.0)))
     (/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -8.2e-156) {
		tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
	} else {
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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+164)) then
        tmp = (y / (y + x)) * (1.0d0 / x)
    else if (x <= (-8.2d-156)) then
        tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0d0))
    else
        tmp = (x / (y + (x + 1.0d0))) / (y + (x * 2.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -8.2e-156) {
		tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
	} else {
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -5e+164:
		tmp = (y / (y + x)) * (1.0 / x)
	elif x <= -8.2e-156:
		tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0))
	else:
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -5e+164)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x));
	elseif (x <= -8.2e-156)
		tmp = Float64(Float64(y / Float64(Float64(y + x) * Float64(y + x))) * Float64(x / Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + Float64(x * 2.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5e+164)
		tmp = (y / (y + x)) * (1.0 / x);
	elseif (x <= -8.2e-156)
		tmp = (y / ((y + x) * (y + x))) * (x / (x + 1.0));
	else
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -8.2e-156], N[(N[(y / N[(N[(y + x), $MachinePrecision] * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -8.2000000000000004e-156

    1. Initial program 79.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.2000000000000004e-156 < x

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 87.0% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.1999999999999998e164 < x < -4.3e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.3e-138 < x

    1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 87.3% accurate, 0.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + \left(y + \left(y + 1\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\ \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+164)
   (* (/ y (+ y x)) (/ 1.0 x))
   (if (<= x -3.5e-138)
     (/ y (* (+ y x) (+ x (+ y (+ y 1.0)))))
     (/ (/ x (+ y (+ x 1.0))) (+ y (* x 2.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -3.5e-138) {
		tmp = y / ((y + x) * (x + (y + (y + 1.0))));
	} else {
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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+164)) then
        tmp = (y / (y + x)) * (1.0d0 / x)
    else if (x <= (-3.5d-138)) then
        tmp = y / ((y + x) * (x + (y + (y + 1.0d0))))
    else
        tmp = (x / (y + (x + 1.0d0))) / (y + (x * 2.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -3.5e-138) {
		tmp = y / ((y + x) * (x + (y + (y + 1.0))));
	} else {
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -5e+164:
		tmp = (y / (y + x)) * (1.0 / x)
	elif x <= -3.5e-138:
		tmp = y / ((y + x) * (x + (y + (y + 1.0))))
	else:
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -5e+164)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x));
	elseif (x <= -3.5e-138)
		tmp = Float64(y / Float64(Float64(y + x) * Float64(x + Float64(y + Float64(y + 1.0)))));
	else
		tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + Float64(x * 2.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5e+164)
		tmp = (y / (y + x)) * (1.0 / x);
	elseif (x <= -3.5e-138)
		tmp = y / ((y + x) * (x + (y + (y + 1.0))));
	else
		tmp = (x / (y + (x + 1.0))) / (y + (x * 2.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+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.5e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + N[(y + N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -3.4999999999999999e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.4999999999999999e-138 < x

    1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 83.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{+164}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;x \leq -2500000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -6e+164)
   (/ (/ y x) (+ x 1.0))
   (if (<= x -2500000000.0)
     (/ y (* x (+ y x)))
     (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6e+164) {
		tmp = (y / x) / (x + 1.0);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= (-6d+164)) then
        tmp = (y / x) / (x + 1.0d0)
    else if (x <= (-2500000000.0d0)) then
        tmp = y / (x * (y + x))
    else if (x <= (-5.05d-138)) 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 <= -6e+164) {
		tmp = (y / x) / (x + 1.0);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= -6e+164:
		tmp = (y / x) / (x + 1.0)
	elif x <= -2500000000.0:
		tmp = y / (x * (y + x))
	elif x <= -5.05e-138:
		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 <= -6e+164)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	elseif (x <= -2500000000.0)
		tmp = Float64(y / Float64(x * Float64(y + x)));
	elseif (x <= -5.05e-138)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6e+164)
		tmp = (y / x) / (x + 1.0);
	elseif (x <= -2500000000.0)
		tmp = y / (x * (y + x));
	elseif (x <= -5.05e-138)
		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, -6e+164], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+164}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{elif}\;x \leq -2500000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000001e164 < x < -2.5e9

    1. Initial program 57.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-+r+57.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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-/r*95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    10. Step-by-step derivation
      1. un-div-inv55.7%

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

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

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

Alternative 7: 83.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -2500000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -5e+164)
   (* (/ y (+ y x)) (/ 1.0 x))
   (if (<= x -2500000000.0)
     (/ y (* x (+ y x)))
     (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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+164)) then
        tmp = (y / (y + x)) * (1.0d0 / x)
    else if (x <= (-2500000000.0d0)) then
        tmp = y / (x * (y + x))
    else if (x <= (-5.05d-138)) 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+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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+164:
		tmp = (y / (y + x)) * (1.0 / x)
	elif x <= -2500000000.0:
		tmp = y / (x * (y + x))
	elif x <= -5.05e-138:
		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+164)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x));
	elseif (x <= -2500000000.0)
		tmp = Float64(y / Float64(x * Float64(y + x)));
	elseif (x <= -5.05e-138)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5e+164)
		tmp = (y / (y + x)) * (1.0 / x);
	elseif (x <= -2500000000.0)
		tmp = y / (x * (y + x));
	elseif (x <= -5.05e-138)
		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+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -2500000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -2.5e9

    1. Initial program 57.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-+r+57.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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-/r*95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    10. Step-by-step derivation
      1. un-div-inv55.7%

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

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

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

Alternative 8: 95.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 69.1%

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

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

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

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

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

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

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

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

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

    if 1.80000000000000004e155 < y

    1. Initial program 67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 83.3% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -5.0499999999999997e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 87.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 66.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. Step-by-step derivation
      1. associate-+r+66.4%

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 95.1% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.15:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{\frac{x}{y + 1}}{y + x}\\ \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.15)
   (* (/ (/ x (+ y (+ x 1.0))) (+ y x)) (/ y x))
   (* (/ y (+ y x)) (/ (/ x (+ y 1.0)) (+ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.15) {
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	} else {
		tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + 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 <= (-1.15d0)) then
        tmp = ((x / (y + (x + 1.0d0))) / (y + x)) * (y / x)
    else
        tmp = (y / (y + x)) * ((x / (y + 1.0d0)) / (y + x))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.15) {
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	} else {
		tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.15:
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x)
	else:
		tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + x))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.15)
		tmp = Float64(Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)) * Float64(y / x));
	else
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.15)
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	else
		tmp = (y / (y + x)) * ((x / (y + 1.0)) / (y + 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, -1.15], N[(N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\

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


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

    1. Initial program 54.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. associate-+r+54.5%

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

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

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

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

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

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

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

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

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

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

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

    if -1.1499999999999999 < x

    1. Initial program 73.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. associate-+r+73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 95.2% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -0.08:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{y + x} \cdot \frac{x}{y + 1}}{y + x}\\ \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 -0.08)
   (* (/ (/ x (+ y (+ x 1.0))) (+ y x)) (/ y x))
   (/ (* (/ y (+ y x)) (/ x (+ y 1.0))) (+ y x))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -0.08) {
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	} else {
		tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + 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 <= (-0.08d0)) then
        tmp = ((x / (y + (x + 1.0d0))) / (y + x)) * (y / x)
    else
        tmp = ((y / (y + x)) * (x / (y + 1.0d0))) / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.08) {
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	} else {
		tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -0.08:
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x)
	else:
		tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -0.08)
		tmp = Float64(Float64(Float64(x / Float64(y + Float64(x + 1.0))) / Float64(y + x)) * Float64(y / x));
	else
		tmp = Float64(Float64(Float64(y / Float64(y + x)) * Float64(x / Float64(y + 1.0))) / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.08)
		tmp = ((x / (y + (x + 1.0))) / (y + x)) * (y / x);
	else
		tmp = ((y / (y + x)) * (x / (y + 1.0))) / (y + 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, -0.08], N[(N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.08:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x} \cdot \frac{y}{x}\\

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


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

    1. Initial program 54.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. associate-+r+54.5%

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

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

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

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

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

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

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

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

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

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

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

    if -0.0800000000000000017 < x

    1. Initial program 73.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. times-frac90.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult85.3%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative85.3%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified85.3%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 83.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\ \;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -5e+164)
   (* (/ y (+ y x)) (/ 1.0 x))
   (if (<= x -5.05e-138) (/ y (* (+ y x) (+ x 1.0))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5e+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -5.05e-138) {
		tmp = y / ((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+164)) then
        tmp = (y / (y + x)) * (1.0d0 / x)
    else if (x <= (-5.05d-138)) then
        tmp = y / ((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+164) {
		tmp = (y / (y + x)) * (1.0 / x);
	} else if (x <= -5.05e-138) {
		tmp = y / ((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+164:
		tmp = (y / (y + x)) * (1.0 / x)
	elif x <= -5.05e-138:
		tmp = y / ((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+164)
		tmp = Float64(Float64(y / Float64(y + x)) * Float64(1.0 / x));
	elseif (x <= -5.05e-138)
		tmp = Float64(y / Float64(Float64(y + x) * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -5e+164)
		tmp = (y / (y + x)) * (1.0 / x);
	elseif (x <= -5.05e-138)
		tmp = y / ((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+164], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(N[(y + x), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+164}:\\
\;\;\;\;\frac{y}{y + x} \cdot \frac{1}{x}\\

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -5.0499999999999997e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    10. Step-by-step derivation
      1. un-div-inv55.7%

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

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

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

Alternative 14: 83.3% accurate, 0.9× speedup?

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

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

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


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

    1. Initial program 42.1%

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9999999999999995e164 < x < -5.0499999999999997e-138

    1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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. times-frac89.1%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult83.4%

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

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/70.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 80.2% accurate, 1.0× speedup?

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

\mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\
\;\;\;\;\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 < -2.5e9

    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. associate-+r+50.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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-/r*95.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

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

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

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

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

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

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

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

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

Alternative 16: 81.6% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2500000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -2500000000.0)
   (/ y (* x (+ y x)))
   (if (<= x -5.05e-138) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= (-2500000000.0d0)) then
        tmp = y / (x * (y + x))
    else if (x <= (-5.05d-138)) 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 <= -2500000000.0) {
		tmp = y / (x * (y + x));
	} else if (x <= -5.05e-138) {
		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 <= -2500000000.0:
		tmp = y / (x * (y + x))
	elif x <= -5.05e-138:
		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 <= -2500000000.0)
		tmp = Float64(y / Float64(x * Float64(y + x)));
	elseif (x <= -5.05e-138)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2500000000.0)
		tmp = y / (x * (y + x));
	elseif (x <= -5.05e-138)
		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, -2500000000.0], N[(y / N[(x * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5.05e-138], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2500000000:\\
\;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\

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

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


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

    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. associate-+r+50.0%

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

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

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/84.7%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.7%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
      6. +-commutative99.7%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
      7. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      8. associate-+l+99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      9. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{y + x}} \]
    5. Step-by-step derivation
      1. clear-num99.1%

        \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{\frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      2. frac-times83.1%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      3. *-rgt-identity83.1%

        \[\leadsto \frac{\color{blue}{y}}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}} \]
      4. div-inv83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \frac{1}{\frac{x}{y + \left(1 + x\right)}}\right)}} \]
      5. associate-+r+83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}\right)} \]
      6. +-commutative83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{x + \left(y + 1\right)}}}\right)} \]
      7. clear-num83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \color{blue}{\frac{x + \left(y + 1\right)}{x}}\right)} \]
      8. +-commutative83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{\left(y + 1\right) + x}}{x}\right)} \]
      9. associate-+r+83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{y + \left(1 + x\right)}}{x}\right)} \]
      10. +-commutative83.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \color{blue}{\left(x + 1\right)}}{x}\right)} \]
    6. Applied egg-rr83.1%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \left(x + 1\right)}{x}\right)}} \]
    7. Taylor expanded in x around inf 70.4%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{x}} \]

    if -2.5e9 < x < -5.0499999999999997e-138

    1. Initial program 93.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-/r*95.7%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative95.7%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative95.7%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative95.7%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/99.3%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative99.3%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/99.3%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg99.3%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative99.3%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative99.3%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg99.3%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative99.3%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+99.3%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified99.3%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 53.1%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative75.3%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative75.3%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative75.3%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/89.0%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative89.0%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/89.0%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg89.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative89.0%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 53.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative53.5%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified53.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. associate-/r*55.7%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
      2. div-inv55.7%

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    9. Applied egg-rr55.7%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y + 1}} \]
    10. Step-by-step derivation
      1. un-div-inv55.7%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
    11. Applied egg-rr55.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification58.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2500000000:\\ \;\;\;\;\frac{y}{x \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 52.4% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+110}:\\ \;\;\;\;\frac{y}{y \cdot 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 -9e+110) (/ y (* y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -9e+110) {
		tmp = y / (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 <= (-9d+110)) then
        tmp = y / (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 <= -9e+110) {
		tmp = y / (y * x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -9e+110:
		tmp = y / (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 <= -9e+110)
		tmp = Float64(y / 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 <= -9e+110)
		tmp = y / (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, -9e+110], N[(y / 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 -9 \cdot 10^{+110}:\\
\;\;\;\;\frac{y}{y \cdot 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 < -9.0000000000000005e110

    1. Initial program 38.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. associate-+r+38.3%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      2. *-commutative38.3%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      3. frac-times77.0%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/77.0%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.8%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
      7. +-commutative99.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      8. associate-+l+99.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      9. +-commutative99.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{y + x}} \]
    5. Step-by-step derivation
      1. clear-num98.8%

        \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{\frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      2. frac-times77.0%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      3. *-rgt-identity77.0%

        \[\leadsto \frac{\color{blue}{y}}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}} \]
      4. div-inv77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \frac{1}{\frac{x}{y + \left(1 + x\right)}}\right)}} \]
      5. associate-+r+77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}\right)} \]
      6. +-commutative77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{x + \left(y + 1\right)}}}\right)} \]
      7. clear-num77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \color{blue}{\frac{x + \left(y + 1\right)}{x}}\right)} \]
      8. +-commutative77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{\left(y + 1\right) + x}}{x}\right)} \]
      9. associate-+r+77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{y + \left(1 + x\right)}}{x}\right)} \]
      10. +-commutative77.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \color{blue}{\left(x + 1\right)}}{x}\right)} \]
    6. Applied egg-rr77.0%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \left(x + 1\right)}{x}\right)}} \]
    7. Taylor expanded in x around inf 77.0%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{x}} \]
    8. Taylor expanded in y around inf 36.4%

      \[\leadsto \frac{y}{\color{blue}{x \cdot y}} \]

    if -9.0000000000000005e110 < x

    1. Initial program 73.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-/r*78.5%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative78.5%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative78.5%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative78.5%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/91.4%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative91.4%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/91.4%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg91.4%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative91.4%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative91.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg91.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative91.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+91.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified91.4%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 52.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative52.3%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified52.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -9 \cdot 10^{+110}:\\ \;\;\;\;\frac{y}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 78.9% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\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 -5.05e-138) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5.05e-138) {
		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 <= (-5.05d-138)) 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 <= -5.05e-138) {
		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 <= -5.05e-138:
		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 <= -5.05e-138)
		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 <= -5.05e-138)
		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, -5.05e-138], 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.05 \cdot 10^{-138}:\\
\;\;\;\;\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 2 regimes
  2. if x < -5.0499999999999997e-138

    1. Initial program 66.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/r*70.9%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative70.9%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative70.9%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative70.9%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/90.1%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative90.1%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/90.1%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg90.1%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative90.1%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative90.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg90.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative90.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+90.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified90.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 55.4%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

    if -5.0499999999999997e-138 < x

    1. Initial program 70.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-/r*75.3%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative75.3%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative75.3%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative75.3%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/89.0%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative89.0%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/89.0%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg89.0%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative89.0%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+89.0%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 53.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative53.5%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified53.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -5.05 \cdot 10^{-138}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 34.3% accurate, 1.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+21}:\\ \;\;\;\;\frac{y}{y \cdot 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.4e+21) (/ y (* y x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.4e+21) {
		tmp = y / (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 <= (-2.4d+21)) then
        tmp = y / (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 <= -2.4e+21) {
		tmp = y / (y * x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.4e+21:
		tmp = y / (y * x)
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.4e+21)
		tmp = Float64(y / 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 <= -2.4e+21)
		tmp = y / (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, -2.4e+21], N[(y / 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 -2.4 \cdot 10^{+21}:\\
\;\;\;\;\frac{y}{y \cdot x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.4e21

    1. Initial program 48.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. associate-+r+48.3%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      2. *-commutative48.3%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      3. frac-times84.2%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/84.1%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.7%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
      6. +-commutative99.7%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
      7. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
      8. associate-+l+99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
      9. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{y + x}} \]
    5. Step-by-step derivation
      1. clear-num99.1%

        \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{\frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      2. frac-times82.6%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}}} \]
      3. *-rgt-identity82.6%

        \[\leadsto \frac{\color{blue}{y}}{\left(y + x\right) \cdot \frac{y + x}{\frac{x}{y + \left(1 + x\right)}}} \]
      4. div-inv82.5%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + x\right) \cdot \frac{1}{\frac{x}{y + \left(1 + x\right)}}\right)}} \]
      5. associate-+r+82.5%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}\right)} \]
      6. +-commutative82.5%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{1}{\frac{x}{\color{blue}{x + \left(y + 1\right)}}}\right)} \]
      7. clear-num82.6%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \color{blue}{\frac{x + \left(y + 1\right)}{x}}\right)} \]
      8. +-commutative82.6%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{\left(y + 1\right) + x}}{x}\right)} \]
      9. associate-+r+82.6%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{\color{blue}{y + \left(1 + x\right)}}{x}\right)} \]
      10. +-commutative82.6%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \color{blue}{\left(x + 1\right)}}{x}\right)} \]
    6. Applied egg-rr82.6%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \frac{y + \left(x + 1\right)}{x}\right)}} \]
    7. Taylor expanded in x around inf 72.7%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \color{blue}{x}} \]
    8. Taylor expanded in y around inf 32.5%

      \[\leadsto \frac{y}{\color{blue}{x \cdot y}} \]

    if -2.4e21 < x

    1. Initial program 74.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-/r*79.1%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative79.1%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative79.1%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative79.1%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/91.0%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative91.0%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/90.9%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg90.9%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative90.9%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative90.9%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg90.9%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative90.9%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+90.9%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified90.9%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 52.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative52.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified52.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 32.1%

      \[\leadsto \frac{x}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification32.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{+21}:\\ \;\;\;\;\frac{y}{y \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 4.4% 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 68.8%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-+r+68.8%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    2. *-commutative68.8%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    3. frac-times89.4%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. associate-*l/83.2%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    5. times-frac99.8%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    6. +-commutative99.8%

      \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
    7. +-commutative99.8%

      \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{\left(y + 1\right) + x}}}{x + y} \]
    8. associate-+l+99.8%

      \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{\color{blue}{y + \left(1 + x\right)}}}{x + y} \]
    9. +-commutative99.8%

      \[\leadsto \frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{\color{blue}{y + x}} \]
  4. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{y + x}} \]
  5. Taylor expanded in y around inf 50.9%

    \[\leadsto \color{blue}{1} \cdot \frac{\frac{x}{y + \left(1 + x\right)}}{y + x} \]
  6. Taylor expanded in x around inf 4.0%

    \[\leadsto 1 \cdot \color{blue}{\frac{1}{x}} \]
  7. Taylor expanded in x around 0 4.0%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  8. Final simplification4.0%

    \[\leadsto \frac{1}{x} \]
  9. Add Preprocessing

Alternative 21: 26.5% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
	return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x / y
end function
assert x < y;
public static double code(double x, double y) {
	return x / y;
}
[x, y] = sort([x, y])
def code(x, y):
	return x / y
x, y = sort([x, y])
function code(x, y)
	return Float64(x / y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 68.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-/r*73.7%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
    2. *-commutative73.7%

      \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    3. +-commutative73.7%

      \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    4. +-commutative73.7%

      \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
    5. associate-*l/89.4%

      \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
    6. +-commutative89.4%

      \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
    7. associate-*r/89.4%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
    8. remove-double-neg89.4%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
    9. +-commutative89.4%

      \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    10. +-commutative89.4%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    11. remove-double-neg89.4%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
    12. +-commutative89.4%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
    13. associate-+l+89.4%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified89.4%

    \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 47.7%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Step-by-step derivation
    1. +-commutative47.7%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
  7. Simplified47.7%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  8. Taylor expanded in y around 0 25.6%

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  9. Final simplification25.6%

    \[\leadsto \frac{x}{y} \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y):
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y)
	return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x))))
end
function tmp = code(x, y)
	tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}

Reproduce

?
herbie shell --seed 2024096 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))