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

Percentage Accurate: 69.3% → 99.3%
Time: 12.5s
Alternatives: 15
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 15 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: 69.3% 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.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.5% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35999999999999996e-117

    1. Initial program 79.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-*l*79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35999999999999996e-117 < y < 3.55e112

    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. associate-/l*83.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.55e112 < y

    1. Initial program 40.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.3% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.35000000000000001e-117

    1. Initial program 79.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-*l*79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35000000000000001e-117 < y < 6.90000000000000034e72

    1. Initial program 73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.90000000000000034e72 < y

    1. Initial program 45.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-*l*45.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 96.1% 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 2.1 \cdot 10^{+79}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) \cdot \frac{t\_0}{y}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ y (+ x 1.0))))
   (if (<= y 2.1e+79)
     (* (/ x (+ x y)) (/ y (* (+ x y) t_0)))
     (/ (/ x y) (* (+ x y) (/ t_0 y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (y <= 2.1e+79) {
		tmp = (x / (x + y)) * (y / ((x + y) * t_0));
	} else {
		tmp = (x / y) / ((x + y) * (t_0 / y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y + (x + 1.0d0)
    if (y <= 2.1d+79) then
        tmp = (x / (x + y)) * (y / ((x + y) * t_0))
    else
        tmp = (x / y) / ((x + y) * (t_0 / y))
    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 <= 2.1e+79) {
		tmp = (x / (x + y)) * (y / ((x + y) * t_0));
	} else {
		tmp = (x / y) / ((x + y) * (t_0 / y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y + (x + 1.0)
	tmp = 0
	if y <= 2.1e+79:
		tmp = (x / (x + y)) * (y / ((x + y) * t_0))
	else:
		tmp = (x / y) / ((x + y) * (t_0 / y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y + Float64(x + 1.0))
	tmp = 0.0
	if (y <= 2.1e+79)
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * t_0)));
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(x + y) * Float64(t_0 / y)));
	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 <= 2.1e+79)
		tmp = (x / (x + y)) * (y / ((x + y) * t_0));
	else
		tmp = (x / y) / ((x + y) * (t_0 / y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, 2.1e+79], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $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 2.1 \cdot 10^{+79}:\\
\;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\

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


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

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

    if 2.10000000000000008e79 < y

    1. Initial program 45.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-*l*45.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 93.1% accurate, 0.8× speedup?

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

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


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

    1. Initial program 69.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-*l*69.7%

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

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

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

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

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

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

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

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

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

    if -8.20000000000000009e-5 < x

    1. Initial program 70.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-*l*70.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 85.1% 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}\;x \leq -2.35 \cdot 10^{-189}:\\ \;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{\left(x + y\right) \cdot \frac{t\_0}{y}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ y (+ x 1.0))))
   (if (<= x -2.35e-189)
     (/ y (* (+ x y) t_0))
     (/ (/ x y) (* (+ x y) (/ t_0 y))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (x <= -2.35e-189) {
		tmp = y / ((x + y) * t_0);
	} else {
		tmp = (x / y) / ((x + y) * (t_0 / y));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y + (x + 1.0d0)
    if (x <= (-2.35d-189)) then
        tmp = y / ((x + y) * t_0)
    else
        tmp = (x / y) / ((x + y) * (t_0 / y))
    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 <= -2.35e-189) {
		tmp = y / ((x + y) * t_0);
	} else {
		tmp = (x / y) / ((x + y) * (t_0 / y));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y + (x + 1.0)
	tmp = 0
	if x <= -2.35e-189:
		tmp = y / ((x + y) * t_0)
	else:
		tmp = (x / y) / ((x + y) * (t_0 / y))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y + Float64(x + 1.0))
	tmp = 0.0
	if (x <= -2.35e-189)
		tmp = Float64(y / Float64(Float64(x + y) * t_0));
	else
		tmp = Float64(Float64(x / y) / Float64(Float64(x + y) * Float64(t_0 / y)));
	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 <= -2.35e-189)
		tmp = y / ((x + y) * t_0);
	else
		tmp = (x / y) / ((x + y) * (t_0 / y));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.35e-189], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(N[(x + y), $MachinePrecision] * N[(t$95$0 / y), $MachinePrecision]), $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 -2.35 \cdot 10^{-189}:\\
\;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\

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


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

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

    if -2.3499999999999998e-189 < x

    1. Initial program 66.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-*l*66.7%

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative94.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+94.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-rr94.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 85.1% accurate, 1.1× speedup?

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

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


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

    1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

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

    if -2.3499999999999998e-189 < x

    1. Initial program 66.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-*l*66.7%

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative94.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+94.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-rr94.2%

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

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

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

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

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

Alternative 9: 82.3% accurate, 1.1× speedup?

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

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


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

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{\frac{\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)}}{y}} \]
      8. distribute-rgt1-in82.5%

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

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

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

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

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

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

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

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

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

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

    if -5.19999999999999961e-128 < x

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 82.1% accurate, 1.4× speedup?

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

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


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

    1. Initial program 76.1%

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

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

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

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

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

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

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

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

    if -4.4999999999999999e-128 < x

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 80.2% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -5.2 \cdot 10^{-128}:\\ \;\;\;\;\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 -5.2e-128) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -5.2e-128) {
		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.2d-128)) 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.2e-128) {
		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.2e-128:
		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.2e-128)
		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 <= -5.2e-128)
		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.2e-128], 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.2 \cdot 10^{-128}:\\
\;\;\;\;\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 2 regimes
  2. if x < -5.19999999999999961e-128

    1. Initial program 76.1%

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

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

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

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

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

    if -5.19999999999999961e-128 < x

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 78.7% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.1 \cdot 10^{-128}:\\ \;\;\;\;\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 -4.1e-128) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -4.1e-128) {
		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 <= (-4.1d-128)) 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 <= -4.1e-128) {
		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 <= -4.1e-128:
		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 <= -4.1e-128)
		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 <= -4.1e-128)
		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, -4.1e-128], 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 -4.1 \cdot 10^{-128}:\\
\;\;\;\;\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 < -4.1e-128

    1. Initial program 76.1%

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

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

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

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

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

    if -4.1e-128 < x

    1. Initial program 67.5%

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

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

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

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

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

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

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

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

Alternative 13: 49.3% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

Alternative 14: 26.8% 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 70.4%

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  9. Add Preprocessing

Alternative 15: 3.5% accurate, 17.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ 1 \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
	return 1.0;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0
x, y = sort([x, y])
function code(x, y)
	return 1.0
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Derivation
  1. Initial program 70.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-*l*70.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  7. 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 2024102 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

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

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