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

Percentage Accurate: 68.9% → 99.3%
Time: 16.8s
Alternatives: 26
Speedup: 1.9×

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 26 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.9% accurate, 1.0× speedup?

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

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

Alternative 1: 99.3% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    9. distribute-rgt1-in62.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)}} \]
    10. fma-def81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 59.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. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e146 < x < -4.49999999999999978e-17

    1. Initial program 68.2%

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

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

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

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

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

    if -4.49999999999999978e-17 < x

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{y + 1}{x}} \cdot \color{blue}{\frac{\frac{y}{x + y}}{x + y}} \]
      4. frac-times85.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+146}:\\ \;\;\;\;\frac{1}{x \cdot \frac{y + \left(x + 1\right)}{y}}\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{x}}\\ \end{array} \]

Alternative 3: 95.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 59.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. times-frac79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.7999999999999992e146 < x < -3.3999999999999998e-17

    1. Initial program 68.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.3999999999999998e-17 < x

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{y + 1}{x}} \cdot \color{blue}{\frac{\frac{y}{x + y}}{x + y}} \]
      4. frac-times85.8%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.8 \cdot 10^{+146}:\\ \;\;\;\;\frac{1}{x \cdot \frac{y + \left(x + 1\right)}{y}}\\ \mathbf{elif}\;x \leq -3.4 \cdot 10^{-17}:\\ \;\;\;\;\frac{x}{y + \left(x + 1\right)} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{y}{x + y}}{\left(x + y\right) \cdot \frac{y + 1}{x}}\\ \end{array} \]

Alternative 4: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 88.3% accurate, 1.0× speedup?

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

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

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


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

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.10000000000000005e-293 < y < 5.20000000000000009e-15

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000009e-15 < y

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.1 \cdot 10^{-293}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;x \cdot \left(\frac{y}{x + y} \cdot \frac{1}{x + y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{x + y}}{y + 1}\\ \end{array} \]

Alternative 6: 88.6% accurate, 1.0× speedup?

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

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

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


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

    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. times-frac88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000002e-294 < y < 2.8000000000000002e-13

    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. Step-by-step derivation
      1. associate-*l*72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.8000000000000002e-13 < y

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-294}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 2.8 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \left(\frac{y}{x + y} \cdot \frac{1}{x + y}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + \left(x + \left(x + 1\right)\right)}\\ \end{array} \]

Alternative 7: 91.1% accurate, 1.0× speedup?

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

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


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

    1. Initial program 63.9%

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

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

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

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

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

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

    if -2.3999999999999999e-6 < x

    1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 91.9% accurate, 1.0× speedup?

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

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


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

    1. Initial program 65.0%

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

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

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

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

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

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

    if -1.56e-24 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in71.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)}} \]
      10. fma-def83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 91.3% accurate, 1.0× speedup?

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

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


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

    1. Initial program 64.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. times-frac86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.39999999999999994e-18 < x

    1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    9. distribute-rgt1-in62.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)}} \]
    10. fma-def81.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 99.2% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    9. distribute-rgt1-in62.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)}} \]
    10. fma-def81.4%

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

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

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

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

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

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

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

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult55.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-in72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 84.9% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 69.2%

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

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

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

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

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

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

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

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

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

    if 1.05000000000000002e-106 < y < 5.20000000000000009e-15

    1. Initial program 94.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000009e-15 < y

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.05 \cdot 10^{-106}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;x \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 13: 88.3% accurate, 1.1× speedup?

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

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

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


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

    1. Initial program 70.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2e-293 < y < 5.20000000000000009e-15

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000009e-15 < y

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -2.2 \cdot 10^{-293}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;x \cdot \frac{\frac{y}{x + y}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 14: 88.3% accurate, 1.1× speedup?

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

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

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


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

    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. times-frac88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.20000000000000016e-296 < y < 4.99999999999999999e-15

    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. Step-by-step derivation
      1. associate-*l*72.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.99999999999999999e-15 < y

    1. Initial program 73.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -9.2 \cdot 10^{-296}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{elif}\;y \leq 5 \cdot 10^{-15}:\\ \;\;\;\;x \cdot \frac{\frac{y}{x + y}}{x + y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot \frac{1}{x + y}}{y + 1}\\ \end{array} \]

Alternative 15: 82.2% accurate, 1.3× speedup?

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

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


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

    1. Initial program 65.0%

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

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

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

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

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

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

    if -8.1999999999999996e-37 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in71.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)}} \]
      10. fma-def83.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 16: 80.0% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 60.3%

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

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

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

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

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

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

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

    if -2.4999999999999999e184 < x < -8.5000000000000007e-37

    1. Initial program 68.1%

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

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

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

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified90.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 68.7%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

    if -8.5000000000000007e-37 < x

    1. Initial program 74.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. times-frac88.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative88.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+88.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified88.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around 0 63.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. +-commutative63.7%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    6. Simplified63.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.5 \cdot 10^{+184}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -8.5 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]

Alternative 17: 81.5% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+183}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -2.9e+183)
   (* (/ 1.0 x) (/ y x))
   (if (<= x -3.8e-37) (/ y (* x (+ x 1.0))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -2.9e+183) {
		tmp = (1.0 / x) * (y / x);
	} else if (x <= -3.8e-37) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-2.9d+183)) then
        tmp = (1.0d0 / x) * (y / x)
    else if (x <= (-3.8d-37)) then
        tmp = y / (x * (x + 1.0d0))
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -2.9e+183) {
		tmp = (1.0 / x) * (y / x);
	} else if (x <= -3.8e-37) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -2.9e+183:
		tmp = (1.0 / x) * (y / x)
	elif x <= -3.8e-37:
		tmp = y / (x * (x + 1.0))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -2.9e+183)
		tmp = Float64(Float64(1.0 / x) * Float64(y / x));
	elseif (x <= -3.8e-37)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -2.9e+183)
		tmp = (1.0 / x) * (y / x);
	elseif (x <= -3.8e-37)
		tmp = y / (x * (x + 1.0));
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -2.9e+183], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.8e-37], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{+183}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

\mathbf{elif}\;x \leq -3.8 \cdot 10^{-37}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -2.9000000000000001e183

    1. Initial program 60.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac81.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative81.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+81.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around inf 96.4%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{y + \left(x + 1\right)} \]
    5. Taylor expanded in x around inf 96.2%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -2.9000000000000001e183 < x < -3.8000000000000004e-37

    1. Initial program 68.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac90.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative90.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+90.2%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified90.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 68.7%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]

    if -3.8000000000000004e-37 < x

    1. Initial program 74.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      2. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      4. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)\right)} \]
      5. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \]
      7. associate-*r/83.4%

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in71.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)}} \]
      10. fma-def83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      11. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      12. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/74.5%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      3. fma-udef62.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      4. cube-mult62.5%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      5. distribute-rgt1-in74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      8. associate-+r+74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
      9. frac-times88.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
      10. *-commutative88.7%

        \[\leadsto \color{blue}{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      11. clear-num88.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y + \left(x + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      12. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{y + \left(x + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      13. frac-times99.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)}} \]
      14. *-un-lft-identity99.7%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)} \]
      15. associate-+r+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(y + x\right) + 1}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(x + y\right)} + 1}{y} \cdot \left(x + y\right)} \]
      17. associate-+l+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + \left(y + 1\right)}}{y} \cdot \left(x + y\right)} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
    6. Taylor expanded in x around 0 64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative64.2%

        \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    8. Simplified64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    9. Taylor expanded in x around 0 63.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + 1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.9 \cdot 10^{+183}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.8 \cdot 10^{-37}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 18: 81.6% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-36}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.05e-36) (/ 1.0 (* (/ x y) (+ x 1.0))) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.05e-36) {
		tmp = 1.0 / ((x / y) * (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 <= (-1.05d-36)) then
        tmp = 1.0d0 / ((x / y) * (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 <= -1.05e-36) {
		tmp = 1.0 / ((x / y) * (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 <= -1.05e-36:
		tmp = 1.0 / ((x / y) * (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 <= -1.05e-36)
		tmp = Float64(1.0 / Float64(Float64(x / y) * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.05e-36)
		tmp = 1.0 / ((x / y) * (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, -1.05e-36], N[(1.0 / N[(N[(x / y), $MachinePrecision] * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.05 \cdot 10^{-36}:\\
\;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.04999999999999995e-36

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative86.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+86.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified86.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 73.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. associate-/r*79.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative79.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    6. Simplified79.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    7. Step-by-step derivation
      1. clear-num79.2%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + 1}{\frac{y}{x}}}} \]
      2. inv-pow79.2%

        \[\leadsto \color{blue}{{\left(\frac{x + 1}{\frac{y}{x}}\right)}^{-1}} \]
      3. div-inv79.2%

        \[\leadsto {\color{blue}{\left(\left(x + 1\right) \cdot \frac{1}{\frac{y}{x}}\right)}}^{-1} \]
      4. clear-num79.2%

        \[\leadsto {\left(\left(x + 1\right) \cdot \color{blue}{\frac{x}{y}}\right)}^{-1} \]
    8. Applied egg-rr79.2%

      \[\leadsto \color{blue}{{\left(\left(x + 1\right) \cdot \frac{x}{y}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-179.2%

        \[\leadsto \color{blue}{\frac{1}{\left(x + 1\right) \cdot \frac{x}{y}}} \]
      2. *-commutative79.2%

        \[\leadsto \frac{1}{\color{blue}{\frac{x}{y} \cdot \left(x + 1\right)}} \]
    10. Simplified79.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}} \]

    if -1.04999999999999995e-36 < x

    1. Initial program 74.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      2. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      4. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)\right)} \]
      5. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \]
      7. associate-*r/83.4%

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in71.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)}} \]
      10. fma-def83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      11. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      12. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/74.5%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      3. fma-udef62.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      4. cube-mult62.5%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      5. distribute-rgt1-in74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      8. associate-+r+74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
      9. frac-times88.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
      10. *-commutative88.7%

        \[\leadsto \color{blue}{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      11. clear-num88.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y + \left(x + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      12. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{y + \left(x + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      13. frac-times99.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)}} \]
      14. *-un-lft-identity99.7%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)} \]
      15. associate-+r+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(y + x\right) + 1}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(x + y\right)} + 1}{y} \cdot \left(x + y\right)} \]
      17. associate-+l+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + \left(y + 1\right)}}{y} \cdot \left(x + y\right)} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
    6. Taylor expanded in x around 0 64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative64.2%

        \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    8. Simplified64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    9. Taylor expanded in x around 0 63.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.05 \cdot 10^{-36}:\\ \;\;\;\;\frac{1}{\frac{x}{y} \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 19: 82.2% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-104}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 1.9e-104) (/ (/ y x) (+ x 1.0)) (/ (/ x (+ x y)) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.9e-104) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.9d-104) then
        tmp = (y / x) / (x + 1.0d0)
    else
        tmp = (x / (x + y)) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.9e-104) {
		tmp = (y / x) / (x + 1.0);
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.9e-104:
		tmp = (y / x) / (x + 1.0)
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.9e-104)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.9e-104)
		tmp = (y / x) / (x + 1.0);
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.9e-104], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-104}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.9e-104

    1. Initial program 69.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac84.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative84.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+84.7%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified84.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 53.9%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. associate-/r*58.0%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative58.0%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    6. Simplified58.0%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if 1.9e-104 < y

    1. Initial program 77.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*77.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      2. +-commutative77.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. +-commutative77.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      4. +-commutative77.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)\right)} \]
      5. associate-*l*77.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. *-commutative77.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \]
      7. associate-*r/85.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)}} \]
      8. *-commutative85.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)}} \]
      9. distribute-rgt1-in81.1%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(y + x\right) \cdot \left(y + x\right) + \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      10. fma-def85.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)}} \]
      11. +-commutative85.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)} \]
      12. +-commutative85.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)} \]
      13. cube-unmult85.6%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative85.6%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified85.6%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/77.5%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. *-commutative77.5%

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      3. fma-udef75.3%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      4. cube-mult75.3%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      5. distribute-rgt1-in77.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      6. *-commutative77.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. +-commutative77.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      8. associate-+r+77.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
      9. frac-times94.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
      10. *-commutative94.7%

        \[\leadsto \color{blue}{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      11. clear-num94.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y + \left(x + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      12. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{y + \left(x + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      13. frac-times99.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)}} \]
      14. *-un-lft-identity99.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)} \]
      15. associate-+r+99.8%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(y + x\right) + 1}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(x + y\right)} + 1}{y} \cdot \left(x + y\right)} \]
      17. associate-+l+99.8%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + \left(y + 1\right)}}{y} \cdot \left(x + y\right)} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
    6. Taylor expanded in x around 0 72.5%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative72.5%

        \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    8. Simplified72.5%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification63.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-104}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]

Alternative 20: 67.0% accurate, 1.9× 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 -3.5 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.0)
   (* (/ 1.0 x) (/ y x))
   (if (<= x -3.5e-201) (- (/ y x) y) (/ x 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 <= -3.5e-201) {
		tmp = (y / x) - y;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.0d0)) then
        tmp = (1.0d0 / x) * (y / x)
    else if (x <= (-3.5d-201)) then
        tmp = (y / x) - y
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.0) {
		tmp = (1.0 / x) * (y / x);
	} else if (x <= -3.5e-201) {
		tmp = (y / x) - y;
	} else {
		tmp = x / 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 <= -3.5e-201:
		tmp = (y / x) - y
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.0)
		tmp = Float64(Float64(1.0 / x) * Float64(y / x));
	elseif (x <= -3.5e-201)
		tmp = Float64(Float64(y / x) - y);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.0)
		tmp = (1.0 / x) * (y / x);
	elseif (x <= -3.5e-201)
		tmp = (y / x) - y;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.0], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.5e-201], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / y), $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 -3.5 \cdot 10^{-201}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1

    1. Initial program 62.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative86.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+86.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified86.0%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around inf 81.7%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{y + \left(x + 1\right)} \]
    5. Taylor expanded in x around inf 80.0%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -1 < x < -3.50000000000000008e-201

    1. Initial program 78.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac88.3%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative88.3%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+88.3%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified88.3%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 33.4%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. associate-/r*33.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative33.4%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    6. Simplified33.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    7. Taylor expanded in x around 0 31.9%

      \[\leadsto \color{blue}{-1 \cdot y + \frac{y}{x}} \]
    8. Step-by-step derivation
      1. neg-mul-131.9%

        \[\leadsto \color{blue}{\left(-y\right)} + \frac{y}{x} \]
      2. +-commutative31.9%

        \[\leadsto \color{blue}{\frac{y}{x} + \left(-y\right)} \]
      3. unsub-neg31.9%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    9. Simplified31.9%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if -3.50000000000000008e-201 < x

    1. Initial program 74.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac89.1%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative89.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+89.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified89.1%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around 0 61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. +-commutative61.8%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    6. Simplified61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    7. Taylor expanded in y around 0 45.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification51.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{elif}\;x \leq -3.5 \cdot 10^{-201}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 21: 78.3% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -4.2e+18) (* (/ 1.0 x) (/ y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -4.2e+18) {
		tmp = (1.0 / x) * (y / x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-4.2d+18)) then
        tmp = (1.0d0 / x) * (y / x)
    else
        tmp = x / (y * (y + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -4.2e+18) {
		tmp = (1.0 / x) * (y / x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -4.2e+18:
		tmp = (1.0 / x) * (y / x)
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -4.2e+18)
		tmp = Float64(Float64(1.0 / x) * Float64(y / x));
	else
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -4.2e+18)
		tmp = (1.0 / x) * (y / x);
	else
		tmp = x / (y * (y + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -4.2e+18], N[(N[(1.0 / x), $MachinePrecision] * N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+18}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.2e18

    1. Initial program 61.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. times-frac85.6%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative85.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+85.6%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified85.6%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around inf 82.7%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{y + \left(x + 1\right)} \]
    5. Taylor expanded in x around inf 82.3%

      \[\leadsto \frac{1}{x} \cdot \color{blue}{\frac{y}{x}} \]

    if -4.2e18 < x

    1. Initial program 75.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac89.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative89.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+89.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified89.0%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around 0 63.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. +-commutative63.3%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    6. Simplified63.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4.2 \cdot 10^{+18}:\\ \;\;\;\;\frac{1}{x} \cdot \frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]

Alternative 22: 82.1% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-37}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -3.3e-37) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -3.3e-37) {
		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 <= (-3.3d-37)) 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 <= -3.3e-37) {
		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 <= -3.3e-37:
		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 <= -3.3e-37)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -3.3e-37)
		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, -3.3e-37], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-37}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.29999999999999982e-37

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative86.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+86.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified86.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 73.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. associate-/r*79.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative79.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    6. Simplified79.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if -3.29999999999999982e-37 < x

    1. Initial program 74.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      2. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      3. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)\right)} \]
      4. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)\right)} \]
      5. associate-*l*74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \]
      7. associate-*r/83.4%

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      8. *-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in71.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)}} \]
      10. fma-def83.4%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      11. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      12. +-commutative83.4%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative83.5%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/74.5%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. *-commutative74.5%

        \[\leadsto \frac{\color{blue}{x \cdot y}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      3. fma-udef62.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      4. cube-mult62.5%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      5. distribute-rgt1-in74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      6. *-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      7. +-commutative74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      8. associate-+r+74.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
      9. frac-times88.7%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
      10. *-commutative88.7%

        \[\leadsto \color{blue}{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      11. clear-num88.7%

        \[\leadsto \color{blue}{\frac{1}{\frac{y + \left(x + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
      12. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{y + \left(x + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      13. frac-times99.7%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)}} \]
      14. *-un-lft-identity99.7%

        \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)} \]
      15. associate-+r+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(y + x\right) + 1}}{y} \cdot \left(x + y\right)} \]
      16. +-commutative99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(x + y\right)} + 1}{y} \cdot \left(x + y\right)} \]
      17. associate-+l+99.7%

        \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + \left(y + 1\right)}}{y} \cdot \left(x + y\right)} \]
    5. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
    6. Taylor expanded in x around 0 64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
    7. Step-by-step derivation
      1. +-commutative64.2%

        \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    8. Simplified64.2%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
    9. Taylor expanded in x around 0 63.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y + 1} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.3 \cdot 10^{-37}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 23: 27.8% accurate, 3.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -0.45:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -0.45) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -0.45) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-0.45d0)) then
        tmp = 1.0d0 / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.45) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -0.45:
		tmp = 1.0 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -0.45)
		tmp = Float64(1.0 / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.45)
		tmp = 1.0 / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -0.45], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.45:\\
\;\;\;\;\frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -0.450000000000000011

    1. Initial program 62.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac86.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative86.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+86.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified86.0%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around inf 81.7%

      \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{y + \left(x + 1\right)} \]
    5. Taylor expanded in y around inf 6.1%

      \[\leadsto \color{blue}{\frac{1}{x}} \]

    if -0.450000000000000011 < x

    1. Initial program 75.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac88.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative88.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+88.9%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified88.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around 0 63.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. +-commutative63.5%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    6. Simplified63.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    7. Taylor expanded in y around 0 41.3%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification33.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.45:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 24: 42.6% accurate, 3.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.5 \cdot 10^{-212}:\\ \;\;\;\;\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 (<= y 3.5e-212) (/ y x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 3.5e-212) {
		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 (y <= 3.5d-212) 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 (y <= 3.5e-212) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 3.5e-212:
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 3.5e-212)
		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 (y <= 3.5e-212)
		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[y, 3.5e-212], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 3.5 \cdot 10^{-212}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 3.4999999999999998e-212

    1. Initial program 69.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. times-frac86.5%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative86.5%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+86.5%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified86.5%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in y around 0 51.7%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    5. Step-by-step derivation
      1. associate-/r*56.4%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative56.4%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    6. Simplified56.4%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]
    7. Taylor expanded in x around 0 32.6%

      \[\leadsto \color{blue}{\frac{y}{x}} \]

    if 3.4999999999999998e-212 < y

    1. Initial program 75.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. times-frac90.5%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative90.5%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      3. associate-+l+90.5%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
    3. Simplified90.5%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    4. Taylor expanded in x around 0 63.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    5. Step-by-step derivation
      1. +-commutative63.8%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    6. Simplified63.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    7. Taylor expanded in y around 0 39.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification35.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.5 \cdot 10^{-212}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]

Alternative 25: 4.4% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 72.1%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. times-frac88.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
    2. +-commutative88.2%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    3. associate-+l+88.2%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{y + \left(x + 1\right)}} \]
  3. Simplified88.2%

    \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
  4. Taylor expanded in x around inf 47.9%

    \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{y + \left(x + 1\right)} \]
  5. Taylor expanded in y around inf 4.1%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  6. Final simplification4.1%

    \[\leadsto \frac{1}{x} \]

Alternative 26: 3.5% accurate, 17.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ 1 \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
	return 1.0;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0
x, y = sort([x, y])
function code(x, y)
	return 1.0
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Derivation
  1. Initial program 72.1%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. associate-*l*72.1%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    2. +-commutative72.1%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)} \]
    3. +-commutative72.1%

      \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)\right)} \]
    4. +-commutative72.1%

      \[\leadsto \frac{x \cdot y}{\left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)\right)} \]
    5. associate-*l*72.1%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
    6. *-commutative72.1%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \]
    7. associate-*r/81.4%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
    8. *-commutative81.4%

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    9. distribute-rgt1-in62.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)}} \]
    10. fma-def81.4%

      \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
    11. +-commutative81.4%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
    12. +-commutative81.4%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
    13. cube-unmult81.4%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
    14. +-commutative81.4%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
  3. Simplified81.4%

    \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/72.2%

      \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    2. *-commutative72.2%

      \[\leadsto \frac{\color{blue}{x \cdot y}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
    3. fma-udef55.3%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    4. cube-mult55.3%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    5. distribute-rgt1-in72.1%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    6. *-commutative72.1%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    7. +-commutative72.1%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
    8. associate-+r+72.1%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    9. frac-times88.2%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{y + \left(x + 1\right)}} \]
    10. *-commutative88.2%

      \[\leadsto \color{blue}{\frac{y}{y + \left(x + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    11. clear-num88.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{y + \left(x + 1\right)}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \]
    12. associate-/r*99.7%

      \[\leadsto \frac{1}{\frac{y + \left(x + 1\right)}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
    13. frac-times99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)}} \]
    14. *-un-lft-identity99.7%

      \[\leadsto \frac{\color{blue}{\frac{x}{x + y}}}{\frac{y + \left(x + 1\right)}{y} \cdot \left(x + y\right)} \]
    15. associate-+r+99.7%

      \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(y + x\right) + 1}}{y} \cdot \left(x + y\right)} \]
    16. +-commutative99.7%

      \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{\left(x + y\right)} + 1}{y} \cdot \left(x + y\right)} \]
    17. associate-+l+99.7%

      \[\leadsto \frac{\frac{x}{x + y}}{\frac{\color{blue}{x + \left(y + 1\right)}}{y} \cdot \left(x + y\right)} \]
  5. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{x + y}}{\frac{x + \left(y + 1\right)}{y} \cdot \left(x + y\right)}} \]
  6. Taylor expanded in x around 0 53.8%

    \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{1 + y}} \]
  7. Step-by-step derivation
    1. +-commutative53.8%

      \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
  8. Simplified53.8%

    \[\leadsto \frac{\frac{x}{x + y}}{\color{blue}{y + 1}} \]
  9. Taylor expanded in y around 0 3.6%

    \[\leadsto \color{blue}{1} \]
  10. Final simplification3.6%

    \[\leadsto 1 \]

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 2023320 
(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))))