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

Percentage Accurate: 69.8% → 99.3%
Time: 17.7s
Alternatives: 17
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 17 alternatives:

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

Initial Program: 69.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.3% accurate, 0.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{\frac{y}{y + x}}{\left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{y + 1}}\right)\right) + 1} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (/ (/ y (+ y x)) (+ (+ x (fma 2.0 y (/ y (/ x (+ y 1.0))))) 1.0)))
assert(x < y);
double code(double x, double y) {
	return (y / (y + x)) / ((x + fma(2.0, y, (y / (x / (y + 1.0))))) + 1.0);
}
x, y = sort([x, y])
function code(x, y)
	return Float64(Float64(y / Float64(y + x)) / Float64(Float64(x + fma(2.0, y, Float64(y / Float64(x / Float64(y + 1.0))))) + 1.0))
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(x + N[(2.0 * y + N[(y / N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{\frac{y}{y + x}}{\left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{y + 1}}\right)\right) + 1}
\end{array}
Derivation
  1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{y}{y + x}}{1 + \left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{\color{blue}{y + 1}}}\right)\right)} \]
  9. Simplified99.1%

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

    \[\leadsto \frac{\frac{y}{y + x}}{\left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{y + 1}}\right)\right) + 1} \]
  11. Add Preprocessing

Alternative 2: 95.6% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.30000000000000008e118 < x < -1.4000000000000001e-16

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4000000000000001e-16 < x

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 97.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000001e131 < x < -9.50000000000000029e-17

    1. Initial program 83.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.50000000000000029e-17 < x

    1. Initial program 66.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.0% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 50.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8000000000000001e131 < x < -2e-79

    1. Initial program 84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2e-79 < x

    1. Initial program 65.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 87.5% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 48.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.8999999999999998e94 < x < -1.55000000000000005e-117

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55000000000000005e-117 < x

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1 \cdot \frac{x}{\color{blue}{1 + y}}}{y} \]
      3. *-lft-identity56.2%

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

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

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

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

Alternative 6: 91.8% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.00419999999999999974 < x < -2.20000000000000004e-268

    1. Initial program 73.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.20000000000000004e-268 < x

    1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 99.2% accurate, 0.8× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{y}{y + x}}{1 + \left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{\color{blue}{y + 1}}}\right)\right)} \]
  9. Simplified99.1%

    \[\leadsto \frac{\frac{y}{y + x}}{\color{blue}{1 + \left(x + \mathsf{fma}\left(2, y, \frac{y}{\frac{x}{y + 1}}\right)\right)}} \]
  10. Step-by-step derivation
    1. fma-udef99.1%

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

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

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

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

Alternative 8: 93.4% accurate, 0.8× speedup?

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

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


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

    1. Initial program 62.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -0.032000000000000001 < x

    1. Initial program 67.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.3% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 85.0% accurate, 1.1× speedup?

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

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


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

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in70.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. associate-+r+70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.9499999999999998e-158 < y

    1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 80.9% accurate, 1.2× speedup?

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 4.4999999999999998e-144 < y

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 82.2% accurate, 1.2× speedup?

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

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


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

    1. Initial program 70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{y \cdot x}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in70.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. associate-+r+70.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{y}{y + x}}{\color{blue}{x + 1}} \]

    if 4.4999999999999998e-144 < y

    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. times-frac87.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. +-commutative87.2%

        \[\leadsto \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1} \]
      3. +-commutative87.2%

        \[\leadsto \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
      4. +-commutative87.2%

        \[\leadsto \frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
      5. times-frac58.5%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      6. associate-*l/76.8%

        \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \cdot y} \]
      7. *-commutative76.8%

        \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
      8. *-commutative76.8%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      9. distribute-rgt1-in68.8%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\left(y + x\right) \cdot \left(y + x\right) + \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
      10. fma-def76.8%

        \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
      11. +-commutative76.8%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      12. +-commutative76.8%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
      13. cube-unmult76.8%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
      14. +-commutative76.8%

        \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
    3. Simplified76.8%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. associate-*r/58.5%

        \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef55.2%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult55.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-in58.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. associate-+r+58.5%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative58.5%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times87.2%

        \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
      8. associate-*l/81.4%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*93.9%

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{x + \left(y + 1\right)}}{x + y}}{x + y}} \]
      10. div-inv93.9%

        \[\leadsto \frac{\frac{y \cdot \color{blue}{\left(x \cdot \frac{1}{x + \left(y + 1\right)}\right)}}{x + y}}{x + y} \]
      11. div-inv93.9%

        \[\leadsto \frac{\frac{y \cdot \color{blue}{\frac{x}{x + \left(y + 1\right)}}}{x + y}}{x + y} \]
      12. +-commutative93.9%

        \[\leadsto \frac{\frac{y \cdot \frac{x}{\color{blue}{\left(y + 1\right) + x}}}{x + y}}{x + y} \]
      13. associate-+l+93.9%

        \[\leadsto \frac{\frac{y \cdot \frac{x}{\color{blue}{y + \left(1 + x\right)}}}{x + y}}{x + y} \]
      14. +-commutative93.9%

        \[\leadsto \frac{\frac{y \cdot \frac{x}{y + \left(1 + x\right)}}{\color{blue}{y + x}}}{x + y} \]
      15. +-commutative93.9%

        \[\leadsto \frac{\frac{y \cdot \frac{x}{y + \left(1 + x\right)}}{y + x}}{\color{blue}{y + x}} \]
    6. Applied egg-rr93.9%

      \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + \left(1 + x\right)}}{y + x}}{y + x}} \]
    7. Taylor expanded in x around 0 62.5%

      \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{y + x} \]
    8. Step-by-step derivation
      1. +-commutative62.5%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + 1}}}{y + x} \]
    9. Simplified62.5%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification58.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-144}:\\ \;\;\;\;\frac{\frac{y}{y + x}}{x + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 78.6% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-144}:\\ \;\;\;\;\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 (<= y 4.5e-144) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 4.5e-144) {
		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 <= 4.5d-144) 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 <= 4.5e-144) {
		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 <= 4.5e-144:
		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 <= 4.5e-144)
		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 (y <= 4.5e-144)
		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, 4.5e-144], 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}\;y \leq 4.5 \cdot 10^{-144}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.4999999999999998e-144

    1. Initial program 70.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-/r*74.0%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative74.0%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative74.0%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative74.0%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/86.4%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative86.4%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/86.4%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg86.4%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative86.4%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.4%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 54.5%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. +-commutative54.5%

        \[\leadsto \frac{y}{x \cdot \color{blue}{\left(x + 1\right)}} \]
    7. Simplified54.5%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]

    if 4.4999999999999998e-144 < y

    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-/r*66.2%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative66.2%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative66.2%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative66.2%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/87.2%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative87.2%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/87.2%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg87.2%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative87.2%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified87.2%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative61.8%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 80.6% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 4.3e-144) (/ y (* x (+ x 1.0))) (/ (/ x (+ y 1.0)) y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 4.3e-144) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 4.3d-144) then
        tmp = y / (x * (x + 1.0d0))
    else
        tmp = (x / (y + 1.0d0)) / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 4.3e-144) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = (x / (y + 1.0)) / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 4.3e-144:
		tmp = y / (x * (x + 1.0))
	else:
		tmp = (x / (y + 1.0)) / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 4.3e-144)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 4.3e-144)
		tmp = y / (x * (x + 1.0));
	else
		tmp = (x / (y + 1.0)) / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 4.3e-144], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.3 \cdot 10^{-144}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 4.2999999999999999e-144

    1. Initial program 70.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-/r*74.0%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative74.0%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative74.0%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative74.0%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/86.4%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative86.4%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/86.4%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg86.4%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative86.4%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+86.4%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified86.4%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in y around 0 54.5%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    6. Step-by-step derivation
      1. +-commutative54.5%

        \[\leadsto \frac{y}{x \cdot \color{blue}{\left(x + 1\right)}} \]
    7. Simplified54.5%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(x + 1\right)}} \]

    if 4.2999999999999999e-144 < y

    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-/r*66.2%

        \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
      2. *-commutative66.2%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      3. +-commutative66.2%

        \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
      4. +-commutative66.2%

        \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
      5. associate-*l/87.2%

        \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
      6. +-commutative87.2%

        \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
      7. associate-*r/87.2%

        \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
      8. remove-double-neg87.2%

        \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
      9. +-commutative87.2%

        \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      10. +-commutative87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
      11. remove-double-neg87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
      12. +-commutative87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
      13. associate-+l+87.2%

        \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified87.2%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Step-by-step derivation
      1. +-commutative61.8%

        \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
    7. Simplified61.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity61.8%

        \[\leadsto \frac{\color{blue}{1 \cdot x}}{y \cdot \left(y + 1\right)} \]
      2. times-frac61.8%

        \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    9. Applied egg-rr61.8%

      \[\leadsto \color{blue}{\frac{1}{y} \cdot \frac{x}{y + 1}} \]
    10. Step-by-step derivation
      1. associate-*l/61.9%

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{y + 1}}{y}} \]
      2. +-commutative61.9%

        \[\leadsto \frac{1 \cdot \frac{x}{\color{blue}{1 + y}}}{y} \]
      3. *-lft-identity61.9%

        \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{y} \]
      4. +-commutative61.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + 1}}}{y} \]
    11. Simplified61.9%

      \[\leadsto \color{blue}{\frac{\frac{x}{y + 1}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 4.3 \cdot 10^{-144}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 48.3% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y \cdot \left(y + 1\right)} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x (* y (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	return x / (y * (y + 1.0));
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x / (y * (y + 1.0d0))
end function
assert x < y;
public static double code(double x, double y) {
	return x / (y * (y + 1.0));
}
[x, y] = sort([x, y])
def code(x, y):
	return x / (y * (y + 1.0))
x, y = sort([x, y])
function code(x, y)
	return Float64(x / Float64(y * Float64(y + 1.0)))
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / (y * (y + 1.0));
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y \cdot \left(y + 1\right)}
\end{array}
Derivation
  1. Initial program 66.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. associate-/r*71.1%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
    2. *-commutative71.1%

      \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    3. +-commutative71.1%

      \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    4. +-commutative71.1%

      \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
    5. associate-*l/86.7%

      \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
    6. +-commutative86.7%

      \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
    7. associate-*r/86.7%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
    8. remove-double-neg86.7%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
    9. +-commutative86.7%

      \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    10. +-commutative86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    11. remove-double-neg86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
    12. +-commutative86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
    13. associate-+l+86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified86.7%

    \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 49.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Step-by-step derivation
    1. +-commutative49.2%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
  7. Simplified49.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  8. Final simplification49.2%

    \[\leadsto \frac{x}{y \cdot \left(y + 1\right)} \]
  9. Add Preprocessing

Alternative 16: 4.3% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{x} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 x))
assert(x < y);
double code(double x, double y) {
	return 1.0 / x;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / x
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / x;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / x
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / x)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / x;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / x), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{x}
\end{array}
Derivation
  1. Initial program 66.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. times-frac86.7%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
    2. +-commutative86.7%

      \[\leadsto \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1} \]
    3. +-commutative86.7%

      \[\leadsto \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}} \cdot \frac{y}{\left(x + y\right) + 1} \]
    4. +-commutative86.7%

      \[\leadsto \frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{\color{blue}{\left(y + x\right)} + 1} \]
    5. times-frac66.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
    6. associate-*l/80.0%

      \[\leadsto \color{blue}{\frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)} \cdot y} \]
    7. *-commutative80.0%

      \[\leadsto \color{blue}{y \cdot \frac{x}{\left(\left(y + x\right) \cdot \left(y + x\right)\right) \cdot \left(\left(y + x\right) + 1\right)}} \]
    8. *-commutative80.0%

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(\left(y + x\right) + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    9. distribute-rgt1-in61.2%

      \[\leadsto y \cdot \frac{x}{\color{blue}{\left(y + x\right) \cdot \left(y + x\right) + \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}} \]
    10. fma-def80.0%

      \[\leadsto y \cdot \frac{x}{\color{blue}{\mathsf{fma}\left(y + x, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)}} \]
    11. +-commutative80.0%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(\color{blue}{x + y}, y + x, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
    12. +-commutative80.0%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, \color{blue}{x + y}, \left(y + x\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)\right)} \]
    13. cube-unmult80.0%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(y + x\right)}^{3}}\right)} \]
    14. +-commutative80.0%

      \[\leadsto y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\color{blue}{\left(x + y\right)}}^{3}\right)} \]
  3. Simplified80.0%

    \[\leadsto \color{blue}{y \cdot \frac{x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. associate-*r/66.0%

      \[\leadsto \color{blue}{\frac{y \cdot x}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    2. fma-udef51.3%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult51.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-in66.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. associate-+r+66.0%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
    6. *-commutative66.0%

      \[\leadsto \frac{y \cdot x}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. frac-times86.7%

      \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
    8. *-commutative86.7%

      \[\leadsto \color{blue}{\frac{x}{x + \left(y + 1\right)} \cdot \frac{y}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    9. associate-/r*99.8%

      \[\leadsto \frac{x}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{y}{x + y}}{x + y}} \]
    10. clear-num99.7%

      \[\leadsto \color{blue}{\frac{1}{\frac{x + \left(y + 1\right)}{x}}} \cdot \frac{\frac{y}{x + y}}{x + y} \]
    11. frac-times99.0%

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x + y}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)}} \]
    12. *-un-lft-identity99.0%

      \[\leadsto \frac{\color{blue}{\frac{y}{x + y}}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)} \]
    13. +-commutative99.0%

      \[\leadsto \frac{\frac{y}{\color{blue}{y + x}}}{\frac{x + \left(y + 1\right)}{x} \cdot \left(x + y\right)} \]
    14. +-commutative99.0%

      \[\leadsto \frac{\frac{y}{y + x}}{\frac{\color{blue}{\left(y + 1\right) + x}}{x} \cdot \left(x + y\right)} \]
    15. associate-+l+99.0%

      \[\leadsto \frac{\frac{y}{y + x}}{\frac{\color{blue}{y + \left(1 + x\right)}}{x} \cdot \left(x + y\right)} \]
    16. +-commutative99.0%

      \[\leadsto \frac{\frac{y}{y + x}}{\frac{y + \left(1 + x\right)}{x} \cdot \color{blue}{\left(y + x\right)}} \]
  6. Applied egg-rr99.0%

    \[\leadsto \color{blue}{\frac{\frac{y}{y + x}}{\frac{y + \left(1 + x\right)}{x} \cdot \left(y + x\right)}} \]
  7. Taylor expanded in x around inf 35.8%

    \[\leadsto \frac{\frac{y}{y + x}}{\color{blue}{x}} \]
  8. Taylor expanded in y around inf 4.2%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  9. Final simplification4.2%

    \[\leadsto \frac{1}{x} \]
  10. Add Preprocessing

Alternative 17: 25.8% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{x}{y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ x y))
assert(x < y);
double code(double x, double y) {
	return x / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = x / y
end function
assert x < y;
public static double code(double x, double y) {
	return x / y;
}
[x, y] = sort([x, y])
def code(x, y):
	return x / y
x, y = sort([x, y])
function code(x, y)
	return Float64(x / y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = x / y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{x}{y}
\end{array}
Derivation
  1. Initial program 66.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. associate-/r*71.1%

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1}} \]
    2. *-commutative71.1%

      \[\leadsto \frac{\frac{\color{blue}{y \cdot x}}{\left(x + y\right) \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    3. +-commutative71.1%

      \[\leadsto \frac{\frac{y \cdot x}{\color{blue}{\left(y + x\right)} \cdot \left(x + y\right)}}{\left(x + y\right) + 1} \]
    4. +-commutative71.1%

      \[\leadsto \frac{\frac{y \cdot x}{\left(y + x\right) \cdot \color{blue}{\left(y + x\right)}}}{\left(x + y\right) + 1} \]
    5. associate-*l/86.7%

      \[\leadsto \frac{\color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}}{\left(x + y\right) + 1} \]
    6. +-commutative86.7%

      \[\leadsto \frac{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot x}{\color{blue}{\left(y + x\right)} + 1} \]
    7. associate-*r/86.7%

      \[\leadsto \color{blue}{\frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{x}{\left(y + x\right) + 1}} \]
    8. remove-double-neg86.7%

      \[\leadsto \frac{y}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{\color{blue}{-\left(-x\right)}}{\left(y + x\right) + 1} \]
    9. +-commutative86.7%

      \[\leadsto \frac{y}{\color{blue}{\left(x + y\right)} \cdot \left(y + x\right)} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    10. +-commutative86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \color{blue}{\left(x + y\right)}} \cdot \frac{-\left(-x\right)}{\left(y + x\right) + 1} \]
    11. remove-double-neg86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{\color{blue}{x}}{\left(y + x\right) + 1} \]
    12. +-commutative86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{\left(x + y\right)} + 1} \]
    13. associate-+l+86.7%

      \[\leadsto \frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified86.7%

    \[\leadsto \color{blue}{\frac{y}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{x}{x + \left(y + 1\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 49.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Step-by-step derivation
    1. +-commutative49.2%

      \[\leadsto \frac{x}{y \cdot \color{blue}{\left(y + 1\right)}} \]
  7. Simplified49.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(y + 1\right)}} \]
  8. Taylor expanded in y around 0 27.3%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  9. Final simplification27.3%

    \[\leadsto \frac{x}{y} \]
  10. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}} \end{array} \]
(FPCore (x y)
 :precision binary64
 (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x)))))
double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = ((x / ((y + 1.0d0) + x)) / (y + x)) / (1.0d0 / (y / (y + x)))
end function
public static double code(double x, double y) {
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
}
def code(x, y):
	return ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)))
function code(x, y)
	return Float64(Float64(Float64(x / Float64(Float64(y + 1.0) + x)) / Float64(y + x)) / Float64(1.0 / Float64(y / Float64(y + x))))
end
function tmp = code(x, y)
	tmp = ((x / ((y + 1.0) + x)) / (y + x)) / (1.0 / (y / (y + x)));
end
code[x_, y_] := N[(N[(N[(x / N[(N[(y + 1.0), $MachinePrecision] + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\frac{x}{\left(y + 1\right) + x}}{y + x}}{\frac{1}{\frac{y}{y + x}}}
\end{array}

Reproduce

?
herbie shell --seed 2024019 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))