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

Percentage Accurate: 68.8% → 99.7%
Time: 13.8s
Alternatives: 23
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 68.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.7% accurate, 0.9× speedup?

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

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

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

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

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

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    6. fma-define68.2%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    7. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    8. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    9. cube-unmult68.2%

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

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

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

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

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

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

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

      \[\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. associate-*l*68.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.5% accurate, 0.6× speedup?

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

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

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

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


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

    1. Initial program 59.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. +-commutative59.1%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define59.1%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative59.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative59.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult59.1%

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in59.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. *-commutative59.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. associate-*l*59.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1000000000000001 < y < 8e19

    1. Initial program 78.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 77.5%

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

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

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

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

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

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

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

    if 8e19 < y < 9.99999999999999934e145

    1. Initial program 69.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. +-commutative69.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define69.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult69.0%

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

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

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

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

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

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

        \[\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. *-commutative69.0%

        \[\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. associate-*l*69.0%

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

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

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

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

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

    if 9.99999999999999934e145 < y

    1. Initial program 44.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. +-commutative44.7%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 96.8% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 58.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. +-commutative58.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define58.3%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult58.4%

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

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

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

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

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

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

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

        \[\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. associate-*l*58.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.2e5 < y < 1.05e134

    1. Initial program 77.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. +-commutative77.9%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define77.9%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative77.9%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative77.9%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult77.9%

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

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

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

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

        \[\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)}} \]
      3. distribute-rgt1-in77.9%

        \[\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)}} \]
      4. *-commutative77.9%

        \[\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)}} \]
      5. associate-*l*77.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)}} \]
      6. times-frac98.7%

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

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

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

    if 1.05e134 < y

    1. Initial program 43.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. +-commutative43.3%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define43.3%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative43.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative43.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult43.3%

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

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

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

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

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

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

        \[\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. associate-*l*43.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 94.9% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 71.5%

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define71.5%

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

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative71.5%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult71.5%

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

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

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

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

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

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

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

        \[\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. associate-*l*71.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.8000000000000001e-23 < y < 8.8000000000000002e77

    1. Initial program 88.3%

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

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

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

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

    if 8.8000000000000002e77 < y

    1. Initial program 47.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. +-commutative47.1%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define47.1%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative47.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative47.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult47.1%

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

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

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

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

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

        \[\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-in47.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. *-commutative47.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. associate-*l*47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 93.5% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 58.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. +-commutative58.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define58.3%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult58.4%

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

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

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

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

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

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

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

        \[\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. associate-*l*58.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2100 < y < 8.2e19

    1. Initial program 78.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 77.6%

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

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

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

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

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

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

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

    if 8.2e19 < y < 3.3999999999999998e149

    1. Initial program 69.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. +-commutative69.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define69.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult69.0%

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

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

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

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

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

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

        \[\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. *-commutative69.0%

        \[\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. associate-*l*69.0%

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

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

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

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

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

    if 3.3999999999999998e149 < y

    1. Initial program 44.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. +-commutative44.7%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 93.6% accurate, 0.7× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{t\_0}{y + 1}\\


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

    1. Initial program 58.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. +-commutative58.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define58.3%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative58.3%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult58.4%

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

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

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

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

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

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

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

        \[\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. associate-*l*58.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -41 < y < 8e19

    1. Initial program 78.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 77.6%

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

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

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

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

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

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

    if 8e19 < y < 6.00000000000000029e148

    1. Initial program 69.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. +-commutative69.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define69.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult69.0%

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

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

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

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

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

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

        \[\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. *-commutative69.0%

        \[\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. associate-*l*69.0%

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

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

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

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

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

    if 6.00000000000000029e148 < y

    1. Initial program 44.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. +-commutative44.7%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 89.1% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 67.1%

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define67.1%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative67.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative67.1%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult67.1%

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

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

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

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

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

        \[\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-in67.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. *-commutative67.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. associate-*l*67.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 3.99999999999999974e-148 < y < 8.5e19

    1. Initial program 90.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*93.0%

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

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

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

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

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

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

    if 8.5e19 < y < 4.2000000000000003e149

    1. Initial program 69.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. +-commutative69.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define69.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult69.0%

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

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

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

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

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

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

        \[\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. *-commutative69.0%

        \[\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. associate-*l*69.0%

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

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

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

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

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

    if 4.2000000000000003e149 < y

    1. Initial program 44.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. +-commutative44.7%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 93.2% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 8e20

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define72.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative72.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative72.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult72.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*72.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8e20 < y < 4.2000000000000003e149

    1. Initial program 69.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. +-commutative69.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define69.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative69.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult69.0%

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

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

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

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

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

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

        \[\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. *-commutative69.0%

        \[\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. associate-*l*69.0%

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

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

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

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

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

    if 4.2000000000000003e149 < y

    1. Initial program 44.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. +-commutative44.7%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

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

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

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

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

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

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

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

        \[\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. associate-*l*44.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 82.2% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 50.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. +-commutative50.2%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define50.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult50.2%

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

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

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

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

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

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

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

        \[\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. associate-*l*50.2%

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

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

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

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

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

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

    if -7.99999999999999947e169 < x < -2.6e10

    1. Initial program 68.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. +-commutative68.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define68.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative68.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative68.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult68.0%

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

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

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

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

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

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

        \[\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. *-commutative68.0%

        \[\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. associate-*l*68.0%

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

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

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

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

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

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

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

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

    if -2.6e10 < x < -2.50000000000000008e-54

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

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

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

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

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

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

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

    if -2.50000000000000008e-54 < x

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

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

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

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

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

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

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

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

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

Alternative 10: 80.7% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -8.2 \cdot 10^{-55}:\\
\;\;\;\;\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 4 regimes
  2. if x < -1.75e171

    1. Initial program 50.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. +-commutative50.2%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define50.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult50.2%

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

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

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

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

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

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

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

        \[\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. associate-*l*50.2%

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

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

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

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

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

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

    if -1.75e171 < x < -2.6e10

    1. Initial program 68.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. +-commutative68.0%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define68.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative68.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative68.0%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult68.0%

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

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

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

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

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

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

        \[\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. *-commutative68.0%

        \[\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. associate-*l*68.0%

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

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

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

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

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

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

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

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

    if -2.6e10 < x < -8.1999999999999996e-55

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

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

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

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

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

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

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

    if -8.1999999999999996e-55 < x

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

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

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

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

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

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

Alternative 11: 98.0% accurate, 0.8× speedup?

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

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


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

    1. Initial program 72.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. +-commutative72.4%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define72.4%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative72.4%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative72.4%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult72.4%

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

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

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

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

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

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

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

        \[\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. associate-*l*72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 0.214999999999999997 < y

    1. Initial program 57.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. +-commutative57.5%

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define57.5%

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

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative57.5%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult57.5%

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

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

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

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

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

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

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

        \[\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. associate-*l*57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      12. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    8. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
    9. Step-by-step derivation
      1. div-inv99.8%

        \[\leadsto \frac{\color{blue}{x \cdot \frac{1}{y + x}}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)} \]
      2. *-commutative99.8%

        \[\leadsto \frac{x \cdot \frac{1}{y + x}}{\color{blue}{\left(y + \left(x + 1\right)\right) \cdot \frac{y + x}{y}}} \]
      3. times-frac99.8%

        \[\leadsto \color{blue}{\frac{x}{y + \left(x + 1\right)} \cdot \frac{\frac{1}{y + x}}{\frac{y + x}{y}}} \]
      4. +-commutative99.8%

        \[\leadsto \frac{x}{y + \left(x + 1\right)} \cdot \frac{\frac{1}{\color{blue}{x + y}}}{\frac{y + x}{y}} \]
      5. +-commutative99.8%

        \[\leadsto \frac{x}{y + \left(x + 1\right)} \cdot \frac{\frac{1}{x + y}}{\frac{\color{blue}{x + y}}{y}} \]
    10. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{x}{y + \left(x + 1\right)} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}}} \]
    11. Taylor expanded in x around inf 98.9%

      \[\leadsto \frac{x}{y + \color{blue}{x}} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 0.215:\\ \;\;\;\;\frac{\frac{x}{x + y}}{\left(x + 1\right) \cdot \frac{x + y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{\frac{1}{x + y}}{\frac{x + y}{y}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 86.6% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-117}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+149}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 3.4e-117)
   (/ (/ y x) (+ x 1.0))
   (if (<= y 4.2e+149)
     (/ x (* (+ x y) (+ x (+ y 1.0))))
     (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 3.4e-117) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 4.2e+149) {
		tmp = x / ((x + y) * (x + (y + 1.0)));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 3.4d-117) then
        tmp = (y / x) / (x + 1.0d0)
    else if (y <= 4.2d+149) then
        tmp = x / ((x + y) * (x + (y + 1.0d0)))
    else
        tmp = (x / (x + y)) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 3.4e-117) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 4.2e+149) {
		tmp = x / ((x + y) * (x + (y + 1.0)));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 3.4e-117:
		tmp = (y / x) / (x + 1.0)
	elif y <= 4.2e+149:
		tmp = x / ((x + y) * (x + (y + 1.0)))
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 3.4e-117)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	elseif (y <= 4.2e+149)
		tmp = Float64(x / Float64(Float64(x + y) * Float64(x + Float64(y + 1.0))));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 3.4e-117)
		tmp = (y / x) / (x + 1.0);
	elseif (y <= 4.2e+149)
		tmp = x / ((x + y) * (x + (y + 1.0)));
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 3.4e-117], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.2e+149], N[(x / N[(N[(x + y), $MachinePrecision] * N[(x + N[(y + 1.0), $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 3.4 \cdot 10^{-117}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{elif}\;y \leq 4.2 \cdot 10^{+149}:\\
\;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 3.40000000000000035e-117

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in46.4%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define67.8%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult67.8%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified67.8%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative67.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define46.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult46.4%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in67.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative67.8%

        \[\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. associate-*l*67.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac93.3%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+93.3%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Step-by-step derivation
      1. clear-num93.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
      3. +-commutative99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{x + \color{blue}{\left(1 + y\right)}} \]
      4. associate-+l+99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + 1\right) + y}} \]
      5. frac-times99.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)}} \]
      6. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      7. times-frac99.8%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{1 \cdot \left(x + y\right)}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      8. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{\color{blue}{x}}{1 \cdot \left(x + y\right)}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      9. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      10. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      12. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    8. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
    9. Taylor expanded in y around 0 59.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    10. Step-by-step derivation
      1. associate-/r*62.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative62.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    11. Simplified62.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if 3.40000000000000035e-117 < y < 4.2000000000000003e149

    1. Initial program 81.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. +-commutative81.5%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative81.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative81.5%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative81.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in71.4%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define81.6%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative81.6%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative81.6%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult81.6%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative81.6%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified81.6%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative81.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define71.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult71.4%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in81.5%

        \[\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. *-commutative81.5%

        \[\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. associate-*l*81.5%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac97.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+97.1%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr97.1%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in y around inf 72.9%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]

    if 4.2000000000000003e149 < y

    1. Initial program 44.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. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define44.7%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult44.7%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative44.7%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified44.7%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative44.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define44.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult44.7%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in44.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative44.7%

        \[\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. associate-*l*44.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac78.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+78.9%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr78.9%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Step-by-step derivation
      1. clear-num78.9%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      2. associate-/r*99.9%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
      3. +-commutative99.9%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{x + \color{blue}{\left(1 + y\right)}} \]
      4. associate-+l+99.9%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + 1\right) + y}} \]
      5. frac-times99.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)}} \]
      6. metadata-eval99.9%

        \[\leadsto \frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      7. times-frac99.9%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{1 \cdot \left(x + y\right)}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      8. *-un-lft-identity99.9%

        \[\leadsto \frac{\frac{\color{blue}{x}}{1 \cdot \left(x + y\right)}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      9. *-un-lft-identity99.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      10. +-commutative99.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      11. +-commutative99.9%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      12. +-commutative99.9%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    8. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
    9. Taylor expanded in x around 0 92.1%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    10. Step-by-step derivation
      1. +-commutative92.1%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
    11. Simplified92.1%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 3.4 \cdot 10^{-117}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 4.2 \cdot 10^{+149}:\\ \;\;\;\;\frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 72.1% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1250000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7.4 \cdot 10^{-163} \lor \neg \left(x \leq 9 \cdot 10^{-169}\right):\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x}}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1250000000.0)
   (* (/ y x) (/ 1.0 x))
   (if (or (<= x -7.4e-163) (not (<= x 9e-169)))
     (/ x (* y y))
     (/ 1.0 (/ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1250000000.0) {
		tmp = (y / x) * (1.0 / x);
	} else if ((x <= -7.4e-163) || !(x <= 9e-169)) {
		tmp = x / (y * y);
	} else {
		tmp = 1.0 / (y / x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1250000000.0d0)) then
        tmp = (y / x) * (1.0d0 / x)
    else if ((x <= (-7.4d-163)) .or. (.not. (x <= 9d-169))) then
        tmp = x / (y * y)
    else
        tmp = 1.0d0 / (y / x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1250000000.0) {
		tmp = (y / x) * (1.0 / x);
	} else if ((x <= -7.4e-163) || !(x <= 9e-169)) {
		tmp = x / (y * y);
	} else {
		tmp = 1.0 / (y / x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1250000000.0:
		tmp = (y / x) * (1.0 / x)
	elif (x <= -7.4e-163) or not (x <= 9e-169):
		tmp = x / (y * y)
	else:
		tmp = 1.0 / (y / x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1250000000.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif ((x <= -7.4e-163) || !(x <= 9e-169))
		tmp = Float64(x / Float64(y * y));
	else
		tmp = Float64(1.0 / Float64(y / x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1250000000.0)
		tmp = (y / x) * (1.0 / x);
	elseif ((x <= -7.4e-163) || ~((x <= 9e-169)))
		tmp = x / (y * y);
	else
		tmp = 1.0 / (y / x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1250000000.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -7.4e-163], N[Not[LessEqual[x, 9e-169]], $MachinePrecision]], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1250000000:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -7.4 \cdot 10^{-163} \lor \neg \left(x \leq 9 \cdot 10^{-169}\right):\\
\;\;\;\;\frac{x}{y \cdot y}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.25e9

    1. Initial program 60.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. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in27.8%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define60.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult60.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified60.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative60.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define27.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult27.8%

        \[\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-in60.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative60.2%

        \[\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. associate-*l*60.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac85.4%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+85.4%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr85.4%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in x around inf 69.8%

      \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
    8. Taylor expanded in y around 0 69.4%

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]

    if -1.25e9 < x < -7.3999999999999998e-163 or 8.9999999999999997e-169 < x

    1. Initial program 75.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*84.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+84.9%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified84.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 41.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around inf 39.2%

      \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]

    if -7.3999999999999998e-163 < x < 8.9999999999999997e-169

    1. Initial program 58.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*72.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+72.0%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified72.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 88.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around 0 79.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
    7. Step-by-step derivation
      1. clear-num79.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
      2. inv-pow79.1%

        \[\leadsto \color{blue}{{\left(\frac{y}{x}\right)}^{-1}} \]
    8. Applied egg-rr79.1%

      \[\leadsto \color{blue}{{\left(\frac{y}{x}\right)}^{-1}} \]
    9. Step-by-step derivation
      1. unpow-179.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
    10. Simplified79.1%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification54.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1250000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7.4 \cdot 10^{-163} \lor \neg \left(x \leq 9 \cdot 10^{-169}\right):\\ \;\;\;\;\frac{x}{y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 82.2% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+170}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{y}{\left(x + 1\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 (<= x -1.7e+170)
   (/ (/ y x) (+ x y))
   (if (<= x -7.2e-54)
     (/ y (* (+ x 1.0) (+ x y)))
     (/ (/ x (+ x y)) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.7e+170) {
		tmp = (y / x) / (x + y);
	} else if (x <= -7.2e-54) {
		tmp = y / ((x + 1.0) * (x + y));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.7d+170)) then
        tmp = (y / x) / (x + y)
    else if (x <= (-7.2d-54)) then
        tmp = y / ((x + 1.0d0) * (x + y))
    else
        tmp = (x / (x + y)) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.7e+170) {
		tmp = (y / x) / (x + y);
	} else if (x <= -7.2e-54) {
		tmp = y / ((x + 1.0) * (x + y));
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.7e+170:
		tmp = (y / x) / (x + y)
	elif x <= -7.2e-54:
		tmp = y / ((x + 1.0) * (x + y))
	else:
		tmp = (x / (x + y)) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.7e+170)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif (x <= -7.2e-54)
		tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(x + y)));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.7e+170)
		tmp = (y / x) / (x + y);
	elseif (x <= -7.2e-54)
		tmp = y / ((x + 1.0) * (x + y));
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.7e+170], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.2e-54], N[(y / N[(N[(x + 1.0), $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}\;x \leq -1.7 \cdot 10^{+170}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\
\;\;\;\;\frac{y}{\left(x + 1\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 x < -1.7000000000000001e170

    1. Initial program 50.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. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in0.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define50.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified50.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative50.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define0.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult0.0%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative50.2%

        \[\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. associate-*l*50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac79.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+79.1%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr79.1%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in x around inf 81.7%

      \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
    8. Step-by-step derivation
      1. frac-times79.1%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(x + y\right) \cdot x}} \]
      2. *-rgt-identity79.1%

        \[\leadsto \frac{\color{blue}{y}}{\left(x + y\right) \cdot x} \]
    9. Applied egg-rr79.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot x}} \]
    10. Step-by-step derivation
      1. associate-/l/81.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + y}} \]
    11. Simplified81.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + y}} \]

    if -1.7000000000000001e170 < x < -7.19999999999999953e-54

    1. Initial program 79.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 67.0%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{x} + 1\right)} \]
    4. Step-by-step derivation
      1. *-commutative67.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + 1\right)} \]
      2. associate-*l*67.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + 1\right)\right)}} \]
      3. times-frac64.0%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)}} \]
      4. +-commutative64.0%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)} \]
      5. +-commutative64.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + 1\right)} \]
    5. Applied egg-rr64.0%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(x + 1\right)}} \]
    6. Taylor expanded in y around 0 51.5%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{1 + x}} \]
    7. Step-by-step derivation
      1. +-commutative51.5%

        \[\leadsto \frac{y}{y + x} \cdot \frac{1}{\color{blue}{x + 1}} \]
    8. Simplified51.5%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x + 1}} \]
    9. Step-by-step derivation
      1. +-commutative51.5%

        \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{1}{x + 1} \]
      2. clear-num51.5%

        \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{\frac{x + 1}{1}}} \]
      3. frac-times61.5%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(x + y\right) \cdot \frac{x + 1}{1}}} \]
      4. *-rgt-identity61.5%

        \[\leadsto \frac{\color{blue}{y}}{\left(x + y\right) \cdot \frac{x + 1}{1}} \]
      5. /-rgt-identity61.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + 1\right)}} \]
      6. +-commutative61.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    10. Applied egg-rr61.5%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(1 + x\right)}} \]

    if -7.19999999999999953e-54 < x

    1. Initial program 68.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. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in60.5%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define68.4%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult68.4%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative68.4%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified68.4%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative68.4%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define60.5%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult60.5%

        \[\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-in68.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative68.4%

        \[\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. associate-*l*68.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac94.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+94.1%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr94.1%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Step-by-step derivation
      1. clear-num94.1%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      2. associate-/r*99.7%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
      3. +-commutative99.7%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{x + \color{blue}{\left(1 + y\right)}} \]
      4. associate-+l+99.7%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + 1\right) + y}} \]
      5. frac-times99.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)}} \]
      6. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      7. times-frac99.8%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{1 \cdot \left(x + y\right)}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      8. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{\color{blue}{x}}{1 \cdot \left(x + y\right)}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      9. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      10. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      12. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    8. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
    9. Taylor expanded in x around 0 56.0%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{1 + y}} \]
    10. Step-by-step derivation
      1. +-commutative56.0%

        \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
    11. Simplified56.0%

      \[\leadsto \frac{\frac{x}{y + x}}{\color{blue}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification60.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+170}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{x + y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 82.3% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{+170}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(x + y\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.45e+170)
   (/ (/ y x) (+ x y))
   (if (<= x -3.3e-55) (/ y (* (+ x 1.0) (+ x y))) (/ (/ x y) (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.45e+170) {
		tmp = (y / x) / (x + y);
	} else if (x <= -3.3e-55) {
		tmp = y / ((x + 1.0) * (x + y));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-1.45d+170)) then
        tmp = (y / x) / (x + y)
    else if (x <= (-3.3d-55)) then
        tmp = y / ((x + 1.0d0) * (x + y))
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -1.45e+170) {
		tmp = (y / x) / (x + y);
	} else if (x <= -3.3e-55) {
		tmp = y / ((x + 1.0) * (x + y));
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.45e+170:
		tmp = (y / x) / (x + y)
	elif x <= -3.3e-55:
		tmp = y / ((x + 1.0) * (x + y))
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.45e+170)
		tmp = Float64(Float64(y / x) / Float64(x + y));
	elseif (x <= -3.3e-55)
		tmp = Float64(y / Float64(Float64(x + 1.0) * Float64(x + y)));
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -1.45e+170)
		tmp = (y / x) / (x + y);
	elseif (x <= -3.3e-55)
		tmp = y / ((x + 1.0) * (x + y));
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -1.45e+170], N[(N[(y / x), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -3.3e-55], N[(y / N[(N[(x + 1.0), $MachinePrecision] * N[(x + y), $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.45 \cdot 10^{+170}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + y}\\

\mathbf{elif}\;x \leq -3.3 \cdot 10^{-55}:\\
\;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(x + y\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.45e170

    1. Initial program 50.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. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in0.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define50.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified50.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative50.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define0.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult0.0%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative50.2%

        \[\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. associate-*l*50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac79.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+79.1%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr79.1%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in x around inf 81.7%

      \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
    8. Step-by-step derivation
      1. frac-times79.1%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(x + y\right) \cdot x}} \]
      2. *-rgt-identity79.1%

        \[\leadsto \frac{\color{blue}{y}}{\left(x + y\right) \cdot x} \]
    9. Applied egg-rr79.1%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot x}} \]
    10. Step-by-step derivation
      1. associate-/l/81.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + y}} \]
    11. Simplified81.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + y}} \]

    if -1.45e170 < x < -3.2999999999999999e-55

    1. Initial program 79.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in x around inf 67.0%

      \[\leadsto \frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\color{blue}{x} + 1\right)} \]
    4. Step-by-step derivation
      1. *-commutative67.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + 1\right)} \]
      2. associate-*l*67.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + 1\right)\right)}} \]
      3. times-frac64.0%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)}} \]
      4. +-commutative64.0%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + 1\right)} \]
      5. +-commutative64.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + 1\right)} \]
    5. Applied egg-rr64.0%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(x + 1\right)}} \]
    6. Taylor expanded in y around 0 51.5%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{1 + x}} \]
    7. Step-by-step derivation
      1. +-commutative51.5%

        \[\leadsto \frac{y}{y + x} \cdot \frac{1}{\color{blue}{x + 1}} \]
    8. Simplified51.5%

      \[\leadsto \frac{y}{y + x} \cdot \color{blue}{\frac{1}{x + 1}} \]
    9. Step-by-step derivation
      1. +-commutative51.5%

        \[\leadsto \frac{y}{\color{blue}{x + y}} \cdot \frac{1}{x + 1} \]
      2. clear-num51.5%

        \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{\frac{x + 1}{1}}} \]
      3. frac-times61.5%

        \[\leadsto \color{blue}{\frac{y \cdot 1}{\left(x + y\right) \cdot \frac{x + 1}{1}}} \]
      4. *-rgt-identity61.5%

        \[\leadsto \frac{\color{blue}{y}}{\left(x + y\right) \cdot \frac{x + 1}{1}} \]
      5. /-rgt-identity61.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + 1\right)}} \]
      6. +-commutative61.5%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(1 + x\right)}} \]
    10. Applied egg-rr61.5%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(1 + x\right)}} \]

    if -3.2999999999999999e-55 < x

    1. Initial program 68.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*80.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+80.0%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified80.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 53.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*55.5%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{1 + y}} \]
      2. +-commutative55.5%

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y + 1}} \]
    7. Simplified55.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification59.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.45 \cdot 10^{+170}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + y}\\ \mathbf{elif}\;x \leq -3.3 \cdot 10^{-55}:\\ \;\;\;\;\frac{y}{\left(x + 1\right) \cdot \left(x + y\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 79.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\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 -1.7e+170)
   (* (/ y x) (/ 1.0 x))
   (if (<= x -7.2e-54) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.7e+170) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -7.2e-54) {
		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 <= (-1.7d+170)) then
        tmp = (y / x) * (1.0d0 / x)
    else if (x <= (-7.2d-54)) 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 <= -1.7e+170) {
		tmp = (y / x) * (1.0 / x);
	} else if (x <= -7.2e-54) {
		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 <= -1.7e+170:
		tmp = (y / x) * (1.0 / x)
	elif x <= -7.2e-54:
		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 <= -1.7e+170)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif (x <= -7.2e-54)
		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 <= -1.7e+170)
		tmp = (y / x) * (1.0 / x);
	elseif (x <= -7.2e-54)
		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, -1.7e+170], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -7.2e-54], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+170}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\
\;\;\;\;\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 < -1.7000000000000001e170

    1. Initial program 50.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. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in0.0%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define50.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative50.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified50.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative50.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define0.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult0.0%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative50.2%

        \[\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. associate-*l*50.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac79.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+79.1%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr79.1%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in x around inf 81.7%

      \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
    8. Taylor expanded in y around 0 81.4%

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]

    if -1.7000000000000001e170 < x < -7.19999999999999953e-54

    1. Initial program 79.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*89.6%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+89.6%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified89.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 52.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. +-commutative52.8%

        \[\leadsto \frac{y}{x \cdot \color{blue}{\left(x + 1\right)}} \]
    7. Simplified52.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]

    if -7.19999999999999953e-54 < x

    1. Initial program 68.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*80.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+80.0%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified80.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 53.2%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification56.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+170}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 99.4% accurate, 1.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(1 + \left(x + y\right)\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (/ x (+ x y)) (* (/ (+ x y) y) (+ 1.0 (+ x y)))))
assert(x < y);
double code(double x, double y) {
	return (x / (x + y)) / (((x + y) / y) * (1.0 + (x + y)));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = (x / (x + y)) / (((x + y) / y) * (1.0d0 + (x + y)))
end function
assert x < y;
public static double code(double x, double y) {
	return (x / (x + y)) / (((x + y) / y) * (1.0 + (x + y)));
}
[x, y] = sort([x, y])
def code(x, y):
	return (x / (x + y)) / (((x + y) / y) * (1.0 + (x + y)))
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(x / Float64(x + y)) / Float64(Float64(Float64(x + y) / y) * Float64(1.0 + Float64(x + y))))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = (x / (x + y)) / (((x + y) / y) * (1.0 + (x + 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[(N[(x + y), $MachinePrecision] / y), $MachinePrecision] * N[(1.0 + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(1 + \left(x + y\right)\right)}
\end{array}
Derivation
  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. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    3. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
    4. *-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    5. distribute-rgt1-in52.9%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    6. fma-define68.2%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    7. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    8. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    9. cube-unmult68.2%

      \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
    10. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
  3. Simplified68.2%

    \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-commutative68.2%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
    2. fma-define52.9%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult52.9%

      \[\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-in68.2%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    5. *-commutative68.2%

      \[\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. associate-*l*68.1%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    7. times-frac92.3%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    8. associate-+r+92.3%

      \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
  6. Applied egg-rr92.3%

    \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  7. Step-by-step derivation
    1. clear-num92.2%

      \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]
    2. associate-/r*99.8%

      \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
    3. +-commutative99.8%

      \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{x + \color{blue}{\left(1 + y\right)}} \]
    4. associate-+l+99.8%

      \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + 1\right) + y}} \]
    5. frac-times99.7%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)}} \]
    6. metadata-eval99.7%

      \[\leadsto \frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    7. times-frac99.7%

      \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{1 \cdot \left(x + y\right)}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    8. *-un-lft-identity99.7%

      \[\leadsto \frac{\frac{\color{blue}{x}}{1 \cdot \left(x + y\right)}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    9. *-un-lft-identity99.7%

      \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    10. +-commutative99.7%

      \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    11. +-commutative99.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
    12. +-commutative99.7%

      \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
  8. Applied egg-rr99.7%

    \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
  9. Taylor expanded in y around 0 99.7%

    \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(1 + \left(x + y\right)\right)}} \]
  10. Final simplification99.7%

    \[\leadsto \frac{\frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(1 + \left(x + y\right)\right)} \]
  11. Add Preprocessing

Alternative 18: 82.3% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 3.3 \cdot 10^{-117}:\\ \;\;\;\;\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 (<= y 3.3e-117) (/ (/ y x) (+ x 1.0)) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 3.3e-117) {
		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 (y <= 3.3d-117) 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 (y <= 3.3e-117) {
		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 y <= 3.3e-117:
		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 (y <= 3.3e-117)
		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 (y <= 3.3e-117)
		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[y, 3.3e-117], 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}\;y \leq 3.3 \cdot 10^{-117}:\\
\;\;\;\;\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 y < 3.30000000000000015e-117

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in46.4%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define67.8%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult67.8%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified67.8%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative67.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define46.4%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult46.4%

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in67.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative67.8%

        \[\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. associate-*l*67.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac93.3%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+93.3%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Step-by-step derivation
      1. clear-num93.3%

        \[\leadsto \color{blue}{\frac{1}{\frac{x + y}{y}}} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + \left(y + 1\right)}} \]
      3. +-commutative99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{x + \color{blue}{\left(1 + y\right)}} \]
      4. associate-+l+99.8%

        \[\leadsto \frac{1}{\frac{x + y}{y}} \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + 1\right) + y}} \]
      5. frac-times99.8%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)}} \]
      6. metadata-eval99.8%

        \[\leadsto \frac{\color{blue}{\frac{1}{1}} \cdot \frac{x}{x + y}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      7. times-frac99.8%

        \[\leadsto \frac{\color{blue}{\frac{1 \cdot x}{1 \cdot \left(x + y\right)}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      8. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{\color{blue}{x}}{1 \cdot \left(x + y\right)}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      9. *-un-lft-identity99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{x + y}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      10. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + x}}}{\frac{x + y}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{\color{blue}{y + x}}{y} \cdot \left(\left(x + 1\right) + y\right)} \]
      12. +-commutative99.8%

        \[\leadsto \frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \color{blue}{\left(y + \left(x + 1\right)\right)}} \]
    8. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + x}}{\frac{y + x}{y} \cdot \left(y + \left(x + 1\right)\right)}} \]
    9. Taylor expanded in y around 0 59.8%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    10. Step-by-step derivation
      1. associate-/r*62.3%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
      2. +-commutative62.3%

        \[\leadsto \frac{\frac{y}{x}}{\color{blue}{x + 1}} \]
    11. Simplified62.3%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{x + 1}} \]

    if 3.30000000000000015e-117 < y

    1. Initial program 68.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.7%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+81.7%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 60.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*65.5%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{1 + y}} \]
      2. +-commutative65.5%

        \[\leadsto \frac{\frac{x}{y}}{\color{blue}{y + 1}} \]
    7. Simplified65.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{y + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 19: 78.2% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -250000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{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 -250000000.0) (* (/ y x) (/ 1.0 x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -250000000.0) {
		tmp = (y / x) * (1.0 / 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 <= (-250000000.0d0)) then
        tmp = (y / x) * (1.0d0 / 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 <= -250000000.0) {
		tmp = (y / x) * (1.0 / x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -250000000.0:
		tmp = (y / x) * (1.0 / x)
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -250000000.0)
		tmp = Float64(Float64(y / x) * Float64(1.0 / 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 <= -250000000.0)
		tmp = (y / x) * (1.0 / 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, -250000000.0], N[(N[(y / x), $MachinePrecision] * N[(1.0 / 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 -250000000:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2.5e8

    1. Initial program 60.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. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      3. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
      4. *-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      5. distribute-rgt1-in27.8%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      6. fma-define60.2%

        \[\leadsto \frac{x \cdot y}{\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)}} \]
      7. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      8. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\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)} \]
      9. cube-unmult60.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      10. +-commutative60.2%

        \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified60.2%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutative60.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
      2. fma-define27.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult27.8%

        \[\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-in60.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. *-commutative60.2%

        \[\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. associate-*l*60.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      7. times-frac85.4%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      8. associate-+r+85.4%

        \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    6. Applied egg-rr85.4%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. Taylor expanded in x around inf 69.8%

      \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
    8. Taylor expanded in y around 0 69.4%

      \[\leadsto \color{blue}{\frac{y}{x}} \cdot \frac{1}{x} \]

    if -2.5e8 < x

    1. Initial program 70.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*81.6%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+81.6%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified81.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 53.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -250000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 47.6% accurate, 1.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot 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 1.0) (/ x y) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.0) {
		tmp = x / y;
	} else {
		tmp = x / (y * 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 <= 1.0d0) then
        tmp = x / y
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.0) {
		tmp = x / y;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.0:
		tmp = x / y
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.0)
		tmp = Float64(x / y);
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.0)
		tmp = x / y;
	else
		tmp = x / (y * 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, 1.0], N[(x / y), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1:\\
\;\;\;\;\frac{x}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1

    1. Initial program 72.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*83.5%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+83.5%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified83.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 36.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around 0 23.3%

      \[\leadsto \color{blue}{\frac{x}{y}} \]

    if 1 < y

    1. Initial program 56.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*77.2%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+77.2%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified77.2%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 74.1%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around inf 73.1%

      \[\leadsto \frac{x}{y \cdot \color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 21: 26.9% accurate, 3.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{\frac{y}{x}} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 (/ y x)))
assert(x < y);
double code(double x, double y) {
	return 1.0 / (y / x);
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / (y / x)
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / (y / x);
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / (y / x)
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / Float64(y / x))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / (y / x);
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{\frac{y}{x}}
\end{array}
Derivation
  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*81.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. associate-+l+81.7%

      \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
  3. Simplified81.7%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 47.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Taylor expanded in y around 0 20.5%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  7. Step-by-step derivation
    1. clear-num20.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
    2. inv-pow20.8%

      \[\leadsto \color{blue}{{\left(\frac{y}{x}\right)}^{-1}} \]
  8. Applied egg-rr20.8%

    \[\leadsto \color{blue}{{\left(\frac{y}{x}\right)}^{-1}} \]
  9. Step-by-step derivation
    1. unpow-120.8%

      \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
  10. Simplified20.8%

    \[\leadsto \color{blue}{\frac{1}{\frac{y}{x}}} \]
  11. Add Preprocessing

Alternative 22: 26.5% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
	return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x / y
end function
assert x < y;
public static double code(double x, double y) {
	return x / y;
}
[x, y] = sort([x, y])
def code(x, y):
	return x / y
x, y = sort([x, y])
function code(x, y)
	return Float64(x / y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 68.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*81.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. associate-+l+81.7%

      \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
  3. Simplified81.7%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 47.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Taylor expanded in y around 0 20.5%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  7. Add Preprocessing

Alternative 23: 4.4% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 68.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. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    3. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\color{blue}{\left(y + x\right)} + 1\right)} \]
    4. *-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    5. distribute-rgt1-in52.9%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    6. fma-define68.2%

      \[\leadsto \frac{x \cdot y}{\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)}} \]
    7. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    8. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\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)} \]
    9. cube-unmult68.2%

      \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
    10. +-commutative68.2%

      \[\leadsto \frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
  3. Simplified68.2%

    \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. *-commutative68.2%

      \[\leadsto \frac{\color{blue}{y \cdot x}}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)} \]
    2. fma-define52.9%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult52.9%

      \[\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-in68.2%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    5. *-commutative68.2%

      \[\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. associate-*l*68.1%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
    7. times-frac92.3%

      \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    8. associate-+r+92.3%

      \[\leadsto \frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
  6. Applied egg-rr92.3%

    \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  7. Taylor expanded in x around inf 41.2%

    \[\leadsto \frac{y}{x + y} \cdot \color{blue}{\frac{1}{x}} \]
  8. Taylor expanded in y around inf 4.4%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  9. Add Preprocessing

Developer Target 1: 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 2024180 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (! :herbie-platform default (/ (/ (/ x (+ (+ y 1) x)) (+ y x)) (/ 1 (/ y (+ y x)))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))