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

Percentage Accurate: 68.3% → 99.8%
Time: 41.5s
Alternatives: 21
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 21 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 68.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.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

Alternative 2: 90.6% accurate, 0.6× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y < 9.8000000000000006e-232

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.8000000000000006e-232 < y < 2.70000000000000016e-25

    1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.70000000000000016e-25 < y < 4.30000000000000025e173

    1. Initial program 73.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.30000000000000025e173 < y

    1. Initial program 64.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 9.8 \cdot 10^{-232}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x + \left(y + \left(y + 1\right)\right)}\\ \mathbf{elif}\;y \leq 2.7 \cdot 10^{-25}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \frac{y + x}{y}}\\ \mathbf{elif}\;y \leq 4.3 \cdot 10^{+173}:\\ \;\;\;\;\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y + x \cdot 2}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 97.1% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 53.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.03999999999999996e155 < x < -5.0000000000000003e-124

    1. Initial program 76.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. *-commutative76.5%

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

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

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

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

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

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

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

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

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

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

    if -5.0000000000000003e-124 < x

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 83.7% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 53.8%

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

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

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

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

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

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

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

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

    if -1.14999999999999999e155 < x < -9.5e5

    1. Initial program 53.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. *-commutative53.5%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5e5 < x < -9.5000000000000005e-108

    1. Initial program 91.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. *-commutative91.4%

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

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

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

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

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

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

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

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

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

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

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

    if -9.5000000000000005e-108 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 88.7% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.8000000000000002e-229 < y < 1.1000000000000001e-11

    1. Initial program 78.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-+r+78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.1000000000000001e-11 < y

    1. Initial program 68.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-+r+68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{y + 1}}{y + \color{blue}{x \cdot 2}} \]
    9. Simplified82.8%

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

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

Alternative 6: 89.0% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.59999999999999985e-232 < y < 9.49999999999999951e-11

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.49999999999999951e-11 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 75.5% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq 2.45 \cdot 10^{-171}:\\
\;\;\;\;\frac{x}{y}\\

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


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

    1. Initial program 55.4%

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

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

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

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

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

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

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

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

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

    if -1 < x < -2.2000000000000001e-108

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    10. Simplified50.8%

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

    if -2.2000000000000001e-108 < x < 2.44999999999999991e-171

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.44999999999999991e-171 < x

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 88.5% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.2000000000000001e-232 < y < 3.9000000000000001e-11

    1. Initial program 78.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-+r+78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.9000000000000001e-11 < y

    1. Initial program 68.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-+r+68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 88.4% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.8000000000000002e-229 < y < 1.00000000000000004e-10

    1. Initial program 79.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.00000000000000004e-10 < y

    1. Initial program 68.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 91.6% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.0000000000000001e-232

    1. Initial program 70.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative70.2%

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative81.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000001e-232 < y

    1. Initial program 72.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-+r+72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 66.8% accurate, 1.0× speedup?

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

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

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


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

    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-+r+70.4%

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

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

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

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

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

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

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

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

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

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

    if 8.2000000000000006e-118 < y < 1.6000000000000001

    1. Initial program 87.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. *-commutative87.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{x}{y} - x} \]
    10. Simplified41.0%

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

    if 1.6000000000000001 < y

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 79.8% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 55.4%

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

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

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

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

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

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

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

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

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

    if -1 < x < -1.69999999999999997e-107

    1. Initial program 90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    10. Simplified50.8%

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

    if -1.69999999999999997e-107 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 80.4% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 50.3%

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

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

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

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

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

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

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

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

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

    if -1e115 < x < -1.79999999999999988e-107

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.79999999999999988e-107 < x

    1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 81.7% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 50.3%

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

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

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

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

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

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

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

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

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

    if -1e115 < x < -1.79999999999999988e-107

    1. Initial program 82.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

    if -1.79999999999999988e-107 < x

    1. Initial program 72.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      5. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      6. +-commutative86.1%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
      7. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
      8. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      9. associate-+l+86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative59.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity59.7%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot \left(y + 1\right)} \]
      2. times-frac61.4%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    9. Applied egg-rr61.4%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    10. Step-by-step derivation
      1. associate-*l/61.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-lft-identity61.4%

        \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y} \]
    11. Simplified61.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + 1}}{y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+115}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 81.8% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.8e-107) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y (+ x 1.0))) y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (y + (x + 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 <= (-1.8d-107)) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (x / (y + (x + 1.0d0))) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (y + (x + 1.0))) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.8e-107:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (x / (y + (x + 1.0))) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.8e-107)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.8e-107)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (x / (y + (x + 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, -1.8e-107], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.79999999999999988e-107

    1. Initial program 69.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. *-commutative69.4%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      5. times-frac90.5%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      6. +-commutative90.5%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
      7. +-commutative90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
      8. +-commutative90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      9. associate-+l+90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified90.5%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 63.9%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*64.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative64.8%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified64.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -1.79999999999999988e-107 < x

    1. Initial program 72.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+r+72.6%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      2. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      3. frac-times86.1%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/81.3%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    5. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
      2. frac-times99.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + \left(y + 1\right)}}{\frac{x + y}{y} \cdot \left(x + y\right)}} \]
      3. *-un-lft-identity99.1%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + \left(y + 1\right)}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      4. associate-+r+99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right) + 1}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      5. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} + 1}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      6. associate-+l+99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + \left(x + 1\right)}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      7. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\frac{\color{blue}{y + x}}{y} \cdot \left(x + y\right)} \]
      8. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    6. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + \left(x + 1\right)}}{\frac{y + x}{y} \cdot \left(y + x\right)}} \]
    7. Taylor expanded in y around inf 61.6%

      \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 81.9% accurate, 1.2× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.8e-107) (/ (/ y (+ y x)) (+ x 1.0)) (/ (/ x (+ y (+ x 1.0))) y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / (y + x)) / (x + 1.0);
	} else {
		tmp = (x / (y + (x + 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 <= (-1.8d-107)) then
        tmp = (y / (y + x)) / (x + 1.0d0)
    else
        tmp = (x / (y + (x + 1.0d0))) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / (y + x)) / (x + 1.0);
	} else {
		tmp = (x / (y + (x + 1.0))) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.8e-107:
		tmp = (y / (y + x)) / (x + 1.0)
	else:
		tmp = (x / (y + (x + 1.0))) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.8e-107)
		tmp = Float64(Float64(y / Float64(y + x)) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / Float64(y + Float64(x + 1.0))) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.8e-107)
		tmp = (y / (y + x)) / (x + 1.0);
	else
		tmp = (x / (y + (x + 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, -1.8e-107], N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.79999999999999988e-107

    1. Initial program 69.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. +-commutative69.4%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative69.4%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative69.4%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. associate-*l/79.1%

        \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \cdot y} \]
      5. *-commutative79.1%

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. *-commutative79.1%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      7. distribute-rgt1-in50.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(y + x\right) \cdot \left(y + x\right) + \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      8. fma-define79.1%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      9. +-commutative79.1%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      10. +-commutative79.1%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      11. cube-unmult79.1%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      12. +-commutative79.1%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified79.1%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/69.4%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-undefine47.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult47.3%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in69.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+69.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times90.5%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      8. *-commutative90.5%

        \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{y}{x + y}}{x + y}} \]
      10. clear-num99.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{x}}} \cdot \frac{\frac{y}{x + y}}{x + y} \]
      11. frac-times98.6%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + y}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)}} \]
      12. *-un-lft-identity98.6%

        \[\leadsto \frac{\color{blue}{\frac{y}{x + y}}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)} \]
    6. Applied egg-rr98.6%

      \[\leadsto \color{blue}{\frac{\frac{y}{x + y}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)}} \]
    7. Taylor expanded in y around 0 65.1%

      \[\leadsto \frac{\frac{y}{x + y}}{\color{blue}{1 + x}} \]
    8. Step-by-step derivation
      1. +-commutative65.1%

        \[\leadsto \frac{\frac{y}{x + y}}{\color{blue}{x + 1}} \]
    9. Simplified65.1%

      \[\leadsto \frac{\frac{y}{x + y}}{\color{blue}{x + 1}} \]

    if -1.79999999999999988e-107 < x

    1. Initial program 72.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+r+72.6%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      2. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      3. frac-times86.1%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/81.3%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    4. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    5. Step-by-step derivation
      1. clear-num99.5%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y} \]
      2. frac-times99.1%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + \left(y + 1\right)}}{\frac{x + y}{y} \cdot \left(x + y\right)}} \]
      3. *-un-lft-identity99.1%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + \left(y + 1\right)}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      4. associate-+r+99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(x + y\right) + 1}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      5. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{\left(y + x\right)} + 1}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      6. associate-+l+99.1%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + \left(x + 1\right)}}}{\frac{x + y}{y} \cdot \left(x + y\right)} \]
      7. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\frac{\color{blue}{y + x}}{y} \cdot \left(x + y\right)} \]
      8. +-commutative99.1%

        \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + x\right)}} \]
    6. Applied egg-rr99.1%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + \left(x + 1\right)}}{\frac{y + x}{y} \cdot \left(y + x\right)}} \]
    7. Taylor expanded in y around inf 61.6%

      \[\leadsto \frac{\frac{x}{y + \left(x + 1\right)}}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + \left(x + 1\right)}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 81.8% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.8e-107) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.8d-107)) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.8e-107) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.8e-107:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.8e-107)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.8e-107)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (x / (y + 1.0)) / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.8e-107], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.79999999999999988e-107

    1. Initial program 69.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. *-commutative69.4%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative69.4%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      5. times-frac90.5%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      6. +-commutative90.5%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
      7. +-commutative90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
      8. +-commutative90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      9. associate-+l+90.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified90.5%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 63.9%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*64.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative64.8%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    7. Simplified64.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -1.79999999999999988e-107 < x

    1. Initial program 72.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      5. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      6. +-commutative86.1%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
      7. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
      8. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      9. associate-+l+86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative59.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity59.7%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot \left(y + 1\right)} \]
      2. times-frac61.4%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    9. Applied egg-rr61.4%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    10. Step-by-step derivation
      1. associate-*l/61.4%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. *-lft-identity61.4%

        \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y} \]
    11. Simplified61.4%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + 1}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.8 \cdot 10^{-107}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 43.0% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-108}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -6.6e-108) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -6.6e-108) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-6.6d-108)) then
        tmp = y / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -6.6e-108) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -6.6e-108:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -6.6e-108)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -6.6e-108)
		tmp = y / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -6.6e-108], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.6 \cdot 10^{-108}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -6.6000000000000004e-108

    1. Initial program 69.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-+r+69.4%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      2. *-commutative69.4%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      3. frac-times90.5%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      4. associate-*l/87.6%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      5. times-frac99.8%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    4. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
    5. Taylor expanded in y around 0 63.9%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. +-commutative63.9%

        \[\leadsto \frac{y}{x \cdot \color{blue}{\left(x + 1\right)}} \]
    7. Simplified63.9%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]
    8. Taylor expanded in x around 0 35.9%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if -6.6000000000000004e-108 < x

    1. Initial program 72.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      4. +-commutative72.6%

        \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      5. times-frac86.1%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      6. +-commutative86.1%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
      7. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
      8. +-commutative86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      9. associate-+l+86.1%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative59.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified59.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Taylor expanded in y around 0 40.9%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification39.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -6.6 \cdot 10^{-108}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 4.3% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 71.5%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate-+r+71.5%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    2. *-commutative71.5%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    3. frac-times87.6%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. associate-*l/83.5%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    5. times-frac99.9%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
  4. Applied egg-rr99.9%

    \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{\frac{x}{x + \left(y + 1\right)}}{x + y}} \]
  5. Taylor expanded in x around inf 31.2%

    \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
  6. Taylor expanded in y around inf 3.9%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  7. Final simplification3.9%

    \[\leadsto \frac{1}{x} \]
  8. Add Preprocessing

Alternative 20: 26.1% 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 71.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. *-commutative71.5%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    3. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    4. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
    5. times-frac87.6%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
    6. +-commutative87.6%

      \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
    7. +-commutative87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
    8. +-commutative87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
    9. associate-+l+87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified87.6%

    \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 50.8%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Step-by-step derivation
    1. +-commutative50.8%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
  7. Simplified50.8%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  8. Taylor expanded in y around 0 28.8%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  9. Final simplification28.8%

    \[\leadsto \frac{x}{y} \]
  10. Add Preprocessing

Alternative 21: 3.8% accurate, 8.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ -y \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (- y))
assert(x < y);
double code(double x, double y) {
	return -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 = -y
end function
assert x < y;
public static double code(double x, double y) {
	return -y;
}
[x, y] = sort([x, y])
def code(x, y):
	return -y
x, y = sort([x, y])
function code(x, y)
	return Float64(-y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = -y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := (-y)
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
-y
\end{array}
Derivation
  1. Initial program 71.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. *-commutative71.5%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    3. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    4. +-commutative71.5%

      \[\leadsto \frac{y \cdot x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
    5. times-frac87.6%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
    6. +-commutative87.6%

      \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1} \]
    7. +-commutative87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{x}{\left(y + x\right) + 1} \]
    8. +-commutative87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
    9. associate-+l+87.6%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified87.6%

    \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in y around 0 48.8%

    \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
  6. Step-by-step derivation
    1. associate-/r*49.0%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
    2. +-commutative49.0%

      \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
  7. Simplified49.0%

    \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
  8. Taylor expanded in x around 0 19.9%

    \[\leadsto \color{blue}{-1 \cdot y + \frac{y}{x}} \]
  9. Step-by-step derivation
    1. neg-mul-119.9%

      \[\leadsto \color{blue}{\left(-y\right)} + \frac{y}{x} \]
    2. +-commutative19.9%

      \[\leadsto \color{blue}{\frac{y}{x} + \left(-y\right)} \]
    3. unsub-neg19.9%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]
  10. Simplified19.9%

    \[\leadsto \color{blue}{\frac{y}{x} - y} \]
  11. Taylor expanded in x around inf 3.6%

    \[\leadsto \color{blue}{-1 \cdot y} \]
  12. Step-by-step derivation
    1. neg-mul-13.6%

      \[\leadsto \color{blue}{-y} \]
  13. Simplified3.6%

    \[\leadsto \color{blue}{-y} \]
  14. Final simplification3.6%

    \[\leadsto -y \]
  15. 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 2024034 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))