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

Percentage Accurate: 69.7% → 99.8%
Time: 16.8s
Alternatives: 23
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 23 alternatives:

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

Initial Program: 69.7% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.9% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -2600000:\\
\;\;\;\;\frac{y}{x} \cdot t_0\\

\mathbf{elif}\;x \leq -2.6 \cdot 10^{-158}:\\
\;\;\;\;t_0 \cdot \frac{y}{y + 1}\\

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


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

    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/76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6000000000000003e122 < x < -2.6e6

    1. Initial program 72.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-frac96.3%

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

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

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

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

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

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

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

    if -2.6e6 < x < -2.6e-158

    1. Initial program 88.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-frac99.7%

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

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

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

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

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

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

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

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

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

    if -2.6e-158 < x

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.6 \cdot 10^{+122}:\\ \;\;\;\;\frac{\frac{y}{y + \left(1 + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -2600000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 3: 91.6% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -3.45 \cdot 10^{-9}:\\
\;\;\;\;y \cdot \frac{\frac{1}{t_0}}{y + x}\\

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

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8999999999999999e170 < x < -3.44999999999999987e-9

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.44999999999999987e-9 < x < -2.6e-158

    1. Initial program 88.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-frac99.6%

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

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

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

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

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

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

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

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

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

    if -2.6e-158 < x

    1. Initial program 66.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{+170}:\\ \;\;\;\;\frac{\frac{y}{y + \left(1 + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -3.45 \cdot 10^{-9}:\\ \;\;\;\;y \cdot \frac{\frac{1}{y + \left(1 + x\right)}}{y + x}\\ \mathbf{elif}\;x \leq -2.6 \cdot 10^{-158}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + x\right)} \cdot \frac{y}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 4: 96.8% accurate, 0.8× speedup?

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

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

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


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

    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/76.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6000000000000003e122 < x < -7.6000000000000002e-17

    1. Initial program 74.8%

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

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

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

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

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

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

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

    if -7.6000000000000002e-17 < x

    1. Initial program 70.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/85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 96.9% accurate, 0.8× speedup?

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

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

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.2000000000000002e169 < x < -7.79999999999999979e-17

    1. Initial program 70.4%

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

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

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

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

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

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

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

    if -7.79999999999999979e-17 < x

    1. Initial program 70.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/85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 94.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;x \leq -3.3 \cdot 10^{-9}:\\
\;\;\;\;y \cdot \frac{\frac{1}{t_0}}{y + x}\\

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


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

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9e168 < x < -3.30000000000000018e-9

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.30000000000000018e-9 < x

    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. associate-*r/85.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 82.0% accurate, 1.3× speedup?

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

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

\mathbf{elif}\;y \leq 8 \cdot 10^{+93}:\\
\;\;\;\;\frac{x}{y + y \cdot y}\\

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


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

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x}} \]
      2. *-un-lft-identity16.0%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    7. Applied egg-rr16.0%

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

    if -6.5e30 < y < 2.29999999999999986e-168

    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-frac89.8%

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

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

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

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

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

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

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

    if 2.29999999999999986e-168 < y < 8.00000000000000035e93

    1. Initial program 84.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-frac96.8%

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

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

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

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

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

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

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

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

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

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

    if 8.00000000000000035e93 < y

    1. Initial program 63.9%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 82.3%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow282.3%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified82.3%

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{y \cdot y}{x}}} \]
      2. associate-/l*84.2%

        \[\leadsto \frac{1}{\color{blue}{\frac{y}{\frac{x}{y}}}} \]
    10. Simplified84.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.5 \cdot 10^{+30}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{y}{x \cdot \left(1 + x\right)}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{\frac{x}{y}}}\\ \end{array} \]

Alternative 8: 82.6% accurate, 1.3× speedup?

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

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


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

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 69.5% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 1.66 \cdot 10^{-96}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 16000000000:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.50000000000000007e-92 or 1.65999999999999993e-96 < y < 1.6e10

    1. Initial program 70.1%

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

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in x around inf 27.4%

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow227.4%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified27.4%

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

    if -1.50000000000000007e-92 < y < 1.65999999999999993e-96

    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-frac88.0%

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

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

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

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

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

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

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

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

    if 1.6e10 < y

    1. Initial program 69.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/87.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 79.7%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow279.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified79.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.5 \cdot 10^{-92}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 1.66 \cdot 10^{-96}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 16000000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 10: 71.4% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 6.5 \cdot 10^{-101}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 6500000000:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1e-84 or 6.4999999999999996e-101 < y < 6.5e9

    1. Initial program 69.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/80.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in x around inf 26.9%

      \[\leadsto \color{blue}{\frac{y}{{x}^{2}}} \]
    5. Step-by-step derivation
      1. unpow226.9%

        \[\leadsto \frac{y}{\color{blue}{x \cdot x}} \]
    6. Simplified26.9%

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

    if -1e-84 < y < 6.4999999999999996e-101

    1. Initial program 70.9%

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

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

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

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

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

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

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

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

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

    if 6.5e9 < y

    1. Initial program 69.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/87.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 79.7%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow279.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified79.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. associate-/r*81.2%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y}} \]
    8. Applied egg-rr81.1%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y}} \]
    9. Step-by-step derivation
      1. associate-*r/81.2%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1 \cdot 10^{-84}:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{elif}\;y \leq 6.5 \cdot 10^{-101}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 6500000000:\\ \;\;\;\;\frac{y}{x \cdot x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 11: 73.0% accurate, 1.5× speedup?

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

\mathbf{elif}\;y \leq 1.72 \cdot 10^{-102}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{elif}\;y \leq 1500000000:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < -1.2000000000000001e-93 or 1.72000000000000009e-102 < y < 1.5e9

    1. Initial program 70.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x}} \]
      2. *-un-lft-identity30.8%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    7. Applied egg-rr30.8%

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

    if -1.2000000000000001e-93 < y < 1.72000000000000009e-102

    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-frac88.0%

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

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

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

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

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

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

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

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

    if 1.5e9 < y

    1. Initial program 69.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/87.3%

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

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

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

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

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 79.7%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow279.7%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified79.7%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
    7. Step-by-step derivation
      1. associate-/r*81.2%

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

        \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y}} \]
    8. Applied egg-rr81.1%

      \[\leadsto \color{blue}{\frac{x}{y} \cdot \frac{1}{y}} \]
    9. Step-by-step derivation
      1. associate-*r/81.2%

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

        \[\leadsto \frac{\color{blue}{\frac{x}{y}}}{y} \]
    10. Simplified81.2%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -1.2 \cdot 10^{-93}:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;y \leq 1.72 \cdot 10^{-102}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{elif}\;y \leq 1500000000:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y}\\ \end{array} \]

Alternative 12: 80.8% accurate, 1.5× speedup?

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

\mathbf{elif}\;x \leq -1.75 \cdot 10^{-101}:\\
\;\;\;\;\frac{y}{x} - y\\

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


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

    1. Initial program 68.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-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. /-rgt-identity86.3%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    7. Applied egg-rr68.3%

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

    if -1 < x < -1.74999999999999997e-101

    1. Initial program 88.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-frac99.6%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    7. Simplified50.9%

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

    if -1.74999999999999997e-101 < x

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1:\\ \;\;\;\;\frac{\frac{y}{x}}{x}\\ \mathbf{elif}\;x \leq -1.75 \cdot 10^{-101}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y + y \cdot y}\\ \end{array} \]

Alternative 13: 82.4% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1 \cdot \frac{y}{x}}{x}} \]
      2. *-un-lft-identity16.0%

        \[\leadsto \frac{\color{blue}{\frac{y}{x}}}{x} \]
    7. Applied egg-rr16.0%

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

    if -6.1000000000000001e30 < y < 2.29999999999999986e-168

    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-frac89.8%

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

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

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

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

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

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

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

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 82.4% accurate, 1.5× speedup?

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

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

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


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

    1. Initial program 57.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.99999999999999956e30 < y < 2.29999999999999986e-168

    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-frac89.8%

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

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

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

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

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

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

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

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 82.6% accurate, 1.5× speedup?

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

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


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

    1. Initial program 67.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times92.1%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative92.1%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
      12. associate-+l+99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
      13. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
      14. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
    6. Taylor expanded in x around 0 66.9%

      \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{y + x} \]
    7. Step-by-step derivation
      1. +-commutative66.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + 1}}}{y + x} \]
    8. Simplified66.9%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]

Alternative 16: 82.6% accurate, 1.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\ \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 2.3e-168) (/ (/ y (+ 1.0 x)) (+ y x)) (/ (/ x (+ y 1.0)) (+ y x))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 2.3e-168) {
		tmp = (y / (1.0 + x)) / (y + 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 (y <= 2.3d-168) then
        tmp = (y / (1.0d0 + x)) / (y + 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 (y <= 2.3e-168) {
		tmp = (y / (1.0 + x)) / (y + x);
	} else {
		tmp = (x / (y + 1.0)) / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 2.3e-168:
		tmp = (y / (1.0 + x)) / (y + x)
	else:
		tmp = (x / (y + 1.0)) / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 2.3e-168)
		tmp = Float64(Float64(y / Float64(1.0 + x)) / Float64(y + 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 (y <= 2.3e-168)
		tmp = (y / (1.0 + x)) / (y + 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[y, 2.3e-168], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / N[(y + x), $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 2.3 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.29999999999999986e-168

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/81.7%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative81.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in56.4%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def81.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult81.7%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/67.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef45.4%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult45.4%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times86.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative86.9%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.7%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
      12. associate-+l+99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
      13. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
      14. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
    6. Taylor expanded in y around 0 57.1%

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{y + x} \]

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative88.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in85.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def88.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult88.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified88.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/73.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef71.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult71.5%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times92.1%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative92.1%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
      12. associate-+l+99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
      13. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
      14. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
    6. Taylor expanded in x around 0 66.9%

      \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{y + x} \]
    7. Step-by-step derivation
      1. +-commutative66.9%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + 1}}}{y + x} \]
    8. Simplified66.9%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{y + x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]

Alternative 17: 82.4% accurate, 1.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 2.3e-168) (/ (/ y (+ 1.0 x)) x) (/ (/ x y) (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 2.3e-168) {
		tmp = (y / (1.0 + x)) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 2.3d-168) then
        tmp = (y / (1.0d0 + x)) / x
    else
        tmp = (x / y) / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 2.3e-168) {
		tmp = (y / (1.0 + x)) / x;
	} else {
		tmp = (x / y) / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 2.3e-168:
		tmp = (y / (1.0 + x)) / x
	else:
		tmp = (x / y) / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 2.3e-168)
		tmp = Float64(Float64(y / Float64(1.0 + x)) / x);
	else
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 2.3e-168)
		tmp = (y / (1.0 + x)) / x;
	else
		tmp = (x / y) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 2.3e-168], N[(N[(y / N[(1.0 + x), $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\
\;\;\;\;\frac{\frac{y}{1 + x}}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 2.29999999999999986e-168

    1. Initial program 67.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/81.7%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative81.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in56.4%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def81.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult81.7%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/67.8%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef45.4%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult45.4%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative67.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times86.9%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative86.9%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.7%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
      12. associate-+l+99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
      13. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
      14. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
    6. Taylor expanded in y around 0 54.5%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    7. Step-by-step derivation
      1. associate-/r*56.5%

        \[\leadsto \color{blue}{\frac{\frac{y}{1 + x}}{x}} \]
    8. Simplified56.5%

      \[\leadsto \color{blue}{\frac{\frac{y}{1 + x}}{x}} \]

    if 2.29999999999999986e-168 < y

    1. Initial program 73.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/88.9%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative88.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in85.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def88.9%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult88.9%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified88.9%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/73.6%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef71.5%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult71.5%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative73.6%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times92.1%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative92.1%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. associate-*r/99.8%

        \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
      11. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
      12. associate-+l+99.8%

        \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
      13. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
      14. +-commutative99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
    6. Step-by-step derivation
      1. clear-num99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\frac{1}{\frac{y + x}{x}}}}{y + x} \]
      2. inv-pow99.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{{\left(\frac{y + x}{x}\right)}^{-1}}}{y + x} \]
    7. Applied egg-rr99.8%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{{\left(\frac{y + x}{x}\right)}^{-1}}}{y + x} \]
    8. Step-by-step derivation
      1. unpow-199.8%

        \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\frac{1}{\frac{y + x}{x}}}}{y + x} \]
    9. Simplified99.8%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\frac{1}{\frac{y + x}{x}}}}{y + x} \]
    10. Taylor expanded in x around 0 65.5%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    11. Step-by-step derivation
      1. associate-/r*66.5%

        \[\leadsto \color{blue}{\frac{\frac{x}{y}}{1 + y}} \]
    12. Simplified66.5%

      \[\leadsto \color{blue}{\frac{\frac{x}{y}}{1 + y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification60.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 2.3 \cdot 10^{-168}:\\ \;\;\;\;\frac{\frac{y}{1 + x}}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]

Alternative 18: 27.6% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= y 8e-47) (/ y x) (/ 1.0 (+ y 1.0))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 8e-47) {
		tmp = y / x;
	} else {
		tmp = 1.0 / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 8d-47) then
        tmp = y / x
    else
        tmp = 1.0d0 / (y + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 8e-47) {
		tmp = y / x;
	} else {
		tmp = 1.0 / (y + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 8e-47:
		tmp = y / x
	else:
		tmp = 1.0 / (y + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 8e-47)
		tmp = Float64(y / x);
	else
		tmp = Float64(1.0 / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 8e-47)
		tmp = y / x;
	else
		tmp = 1.0 / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 8e-47], N[(y / x), $MachinePrecision], N[(1.0 / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{y + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.9999999999999998e-47

    1. Initial program 69.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac88.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified88.0%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in y around 0 56.3%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    5. Taylor expanded in x around 0 37.8%

      \[\leadsto \frac{y}{\color{blue}{x}} \]

    if 7.9999999999999998e-47 < y

    1. Initial program 72.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/88.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative88.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in85.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def88.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult88.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified88.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/72.2%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef70.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult70.8%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times91.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative91.2%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. frac-times91.2%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + y}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)}} \]
      11. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{y + x}}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)} \]
      12. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(\left(y + 1\right) + x\right)} \cdot \left(x + y\right)} \]
      13. associate-+l+91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(y + \left(1 + x\right)\right)} \cdot \left(x + y\right)} \]
      14. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr91.2%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \left(y + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*99.9%

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y + \left(1 + x\right)}}{y + x}} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{\color{blue}{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}}{y + x} \]
      3. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot \frac{y}{y + \left(1 + x\right)}}}{y + x} \]
      4. associate-*r/99.9%

        \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y + x} \cdot y}{y + \left(1 + x\right)}}}{y + x} \]
      5. *-commutative99.9%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot \frac{x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
      6. associate-*r/78.3%

        \[\leadsto \frac{\frac{\color{blue}{\frac{y \cdot x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
      7. +-commutative78.3%

        \[\leadsto \frac{\frac{\frac{y \cdot x}{y + x}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
    7. Simplified78.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{y \cdot x}{y + x}}{y + \left(x + 1\right)}}{y + x}} \]
    8. Taylor expanded in y around 0 25.5%

      \[\leadsto \frac{\frac{\color{blue}{y}}{y + \left(x + 1\right)}}{y + x} \]
    9. Taylor expanded in x around 0 5.7%

      \[\leadsto \color{blue}{\frac{1}{1 + y}} \]
    10. Step-by-step derivation
      1. +-commutative5.7%

        \[\leadsto \frac{1}{\color{blue}{y + 1}} \]
    11. Simplified5.7%

      \[\leadsto \color{blue}{\frac{1}{y + 1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y + 1}\\ \end{array} \]

Alternative 19: 60.2% accurate, 2.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{-17}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= y 1.15e-17) (/ y x) (/ x (* y y))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.15e-17) {
		tmp = y / x;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.15d-17) then
        tmp = y / x
    else
        tmp = x / (y * y)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.15e-17) {
		tmp = y / x;
	} else {
		tmp = x / (y * y);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.15e-17:
		tmp = y / x
	else:
		tmp = x / (y * y)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.15e-17)
		tmp = Float64(y / x);
	else
		tmp = Float64(x / Float64(y * y));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.15e-17)
		tmp = y / x;
	else
		tmp = x / (y * y);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.15e-17], N[(y / x), $MachinePrecision], N[(x / N[(y * y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.15 \cdot 10^{-17}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.15000000000000004e-17

    1. Initial program 69.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac88.1%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity88.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/88.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity88.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+88.1%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified88.1%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in y around 0 56.8%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    5. Taylor expanded in x around 0 37.4%

      \[\leadsto \frac{y}{\color{blue}{x}} \]

    if 1.15000000000000004e-17 < y

    1. Initial program 71.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/87.7%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative87.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in84.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def87.7%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult87.7%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified87.7%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Taylor expanded in y around inf 73.8%

      \[\leadsto \color{blue}{\frac{x}{{y}^{2}}} \]
    5. Step-by-step derivation
      1. unpow273.8%

        \[\leadsto \frac{x}{\color{blue}{y \cdot y}} \]
    6. Simplified73.8%

      \[\leadsto \color{blue}{\frac{x}{y \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification47.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.15 \cdot 10^{-17}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot y}\\ \end{array} \]

Alternative 20: 27.6% accurate, 3.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= y 8e-47) (/ y x) (/ 1.0 y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 8e-47) {
		tmp = y / x;
	} else {
		tmp = 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 <= 8d-47) then
        tmp = y / x
    else
        tmp = 1.0d0 / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 8e-47) {
		tmp = y / x;
	} else {
		tmp = 1.0 / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 8e-47:
		tmp = y / x
	else:
		tmp = 1.0 / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 8e-47)
		tmp = Float64(y / x);
	else
		tmp = Float64(1.0 / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 8e-47)
		tmp = y / x;
	else
		tmp = 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, 8e-47], N[(y / x), $MachinePrecision], N[(1.0 / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\
\;\;\;\;\frac{y}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 7.9999999999999998e-47

    1. Initial program 69.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. times-frac88.0%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
      2. /-rgt-identity88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
      3. associate-/l/88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. *-lft-identity88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
      5. associate-+l+88.0%

        \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
    3. Simplified88.0%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    4. Taylor expanded in y around 0 56.3%

      \[\leadsto \color{blue}{\frac{y}{\left(1 + x\right) \cdot x}} \]
    5. Taylor expanded in x around 0 37.8%

      \[\leadsto \frac{y}{\color{blue}{x}} \]

    if 7.9999999999999998e-47 < y

    1. Initial program 72.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-*r/88.0%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. *-commutative88.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      3. distribute-rgt1-in85.1%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. fma-def88.0%

        \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
      5. cube-unmult88.0%

        \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
    3. Simplified88.0%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    4. Step-by-step derivation
      1. associate-*r/72.2%

        \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
      2. fma-udef70.8%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
      3. cube-mult70.8%

        \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      4. distribute-rgt1-in72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
      5. associate-+r+72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
      6. *-commutative72.2%

        \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
      7. frac-times91.2%

        \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
      8. *-commutative91.2%

        \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
      9. associate-/r*99.8%

        \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
      10. frac-times91.2%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + y}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)}} \]
      11. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{y + x}}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)} \]
      12. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(\left(y + 1\right) + x\right)} \cdot \left(x + y\right)} \]
      13. associate-+l+91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(y + \left(1 + x\right)\right)} \cdot \left(x + y\right)} \]
      14. +-commutative91.2%

        \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \color{blue}{\left(y + x\right)}} \]
    5. Applied egg-rr91.2%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \left(y + x\right)}} \]
    6. Step-by-step derivation
      1. associate-/r*99.9%

        \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y + \left(1 + x\right)}}{y + x}} \]
      2. associate-*l/99.8%

        \[\leadsto \frac{\color{blue}{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}}{y + x} \]
      3. *-commutative99.8%

        \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot \frac{y}{y + \left(1 + x\right)}}}{y + x} \]
      4. associate-*r/99.9%

        \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y + x} \cdot y}{y + \left(1 + x\right)}}}{y + x} \]
      5. *-commutative99.9%

        \[\leadsto \frac{\frac{\color{blue}{y \cdot \frac{x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
      6. associate-*r/78.3%

        \[\leadsto \frac{\frac{\color{blue}{\frac{y \cdot x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
      7. +-commutative78.3%

        \[\leadsto \frac{\frac{\frac{y \cdot x}{y + x}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
    7. Simplified78.3%

      \[\leadsto \color{blue}{\frac{\frac{\frac{y \cdot x}{y + x}}{y + \left(x + 1\right)}}{y + x}} \]
    8. Taylor expanded in y around 0 25.5%

      \[\leadsto \frac{\frac{\color{blue}{y}}{y + \left(x + 1\right)}}{y + x} \]
    9. Taylor expanded in y around inf 5.6%

      \[\leadsto \color{blue}{\frac{1}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification28.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8 \cdot 10^{-47}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{y}\\ \end{array} \]

Alternative 21: 3.8% 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 70.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/84.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. *-commutative84.4%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    3. distribute-rgt1-in67.7%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. fma-def84.5%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
    5. cube-unmult84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
  3. Simplified84.5%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/70.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    2. fma-udef55.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult55.5%

      \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. distribute-rgt1-in70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    5. associate-+r+70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
    6. *-commutative70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. frac-times88.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    8. *-commutative88.9%

      \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    9. associate-/r*99.8%

      \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
    10. associate-*r/99.8%

      \[\leadsto \color{blue}{\frac{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{x + y}}{x + y}} \]
    11. +-commutative99.8%

      \[\leadsto \frac{\frac{y}{\color{blue}{\left(y + 1\right) + x}} \cdot \frac{x}{x + y}}{x + y} \]
    12. associate-+l+99.8%

      \[\leadsto \frac{\frac{y}{\color{blue}{y + \left(1 + x\right)}} \cdot \frac{x}{x + y}}{x + y} \]
    13. +-commutative99.8%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{\color{blue}{y + x}}}{x + y} \]
    14. +-commutative99.8%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{\color{blue}{y + x}} \]
  5. Applied egg-rr99.8%

    \[\leadsto \color{blue}{\frac{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}{y + x}} \]
  6. Taylor expanded in x around inf 47.9%

    \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\left(1 + -1 \cdot \frac{y}{x}\right)}}{y + x} \]
  7. Step-by-step derivation
    1. mul-1-neg47.9%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \left(1 + \color{blue}{\left(-\frac{y}{x}\right)}\right)}{y + x} \]
    2. unsub-neg47.9%

      \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\left(1 - \frac{y}{x}\right)}}{y + x} \]
  8. Simplified47.9%

    \[\leadsto \frac{\frac{y}{y + \left(1 + x\right)} \cdot \color{blue}{\left(1 - \frac{y}{x}\right)}}{y + x} \]
  9. Taylor expanded in y around inf 3.7%

    \[\leadsto \color{blue}{\frac{-1}{x}} \]
  10. Final simplification3.7%

    \[\leadsto \frac{-1}{x} \]

Alternative 22: 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 70.0%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. times-frac88.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\left(x + y\right) + 1}} \]
    2. /-rgt-identity88.9%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{\frac{y}{\left(x + y\right) + 1}}{1}} \]
    3. associate-/l/88.9%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \color{blue}{\frac{y}{1 \cdot \left(\left(x + y\right) + 1\right)}} \]
    4. *-lft-identity88.9%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{\left(x + y\right) + 1}} \]
    5. associate-+l+88.9%

      \[\leadsto \frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{\color{blue}{x + \left(y + 1\right)}} \]
  3. Simplified88.9%

    \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
  4. Taylor expanded in x around inf 48.4%

    \[\leadsto \color{blue}{\frac{1}{x}} \cdot \frac{y}{x + \left(y + 1\right)} \]
  5. Taylor expanded in y around inf 4.1%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  6. Final simplification4.1%

    \[\leadsto \frac{1}{x} \]

Alternative 23: 4.1% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \frac{1}{y} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (/ 1.0 y))
assert(x < y);
double code(double x, double y) {
	return 1.0 / y;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0 / y
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0 / y;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0 / y
x, y = sort([x, y])
function code(x, y)
	return Float64(1.0 / y)
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0 / y;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := N[(1.0 / y), $MachinePrecision]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\frac{1}{y}
\end{array}
Derivation
  1. Initial program 70.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/84.4%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
    2. *-commutative84.4%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    3. distribute-rgt1-in67.7%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. fma-def84.5%

      \[\leadsto x \cdot \frac{y}{\color{blue}{\mathsf{fma}\left(x + y, x + y, \left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)\right)}} \]
    5. cube-unmult84.5%

      \[\leadsto x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, \color{blue}{{\left(x + y\right)}^{3}}\right)} \]
  3. Simplified84.5%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
  4. Step-by-step derivation
    1. associate-*r/70.0%

      \[\leadsto \color{blue}{\frac{x \cdot y}{\mathsf{fma}\left(x + y, x + y, {\left(x + y\right)}^{3}\right)}} \]
    2. fma-udef55.5%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + y\right) \cdot \left(x + y\right) + {\left(x + y\right)}^{3}}} \]
    3. cube-mult55.5%

      \[\leadsto \frac{x \cdot y}{\left(x + y\right) \cdot \left(x + y\right) + \color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    4. distribute-rgt1-in70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) + 1\right) \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)}} \]
    5. associate-+r+70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(x + \left(y + 1\right)\right)} \cdot \left(\left(x + y\right) \cdot \left(x + y\right)\right)} \]
    6. *-commutative70.0%

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    7. frac-times88.9%

      \[\leadsto \color{blue}{\frac{x}{\left(x + y\right) \cdot \left(x + y\right)} \cdot \frac{y}{x + \left(y + 1\right)}} \]
    8. *-commutative88.9%

      \[\leadsto \color{blue}{\frac{y}{x + \left(y + 1\right)} \cdot \frac{x}{\left(x + y\right) \cdot \left(x + y\right)}} \]
    9. associate-/r*99.8%

      \[\leadsto \frac{y}{x + \left(y + 1\right)} \cdot \color{blue}{\frac{\frac{x}{x + y}}{x + y}} \]
    10. frac-times93.5%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{x + y}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)}} \]
    11. +-commutative93.5%

      \[\leadsto \frac{y \cdot \frac{x}{\color{blue}{y + x}}}{\left(x + \left(y + 1\right)\right) \cdot \left(x + y\right)} \]
    12. +-commutative93.5%

      \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(\left(y + 1\right) + x\right)} \cdot \left(x + y\right)} \]
    13. associate-+l+93.5%

      \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\color{blue}{\left(y + \left(1 + x\right)\right)} \cdot \left(x + y\right)} \]
    14. +-commutative93.5%

      \[\leadsto \frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \color{blue}{\left(y + x\right)}} \]
  5. Applied egg-rr93.5%

    \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{y + x}}{\left(y + \left(1 + x\right)\right) \cdot \left(y + x\right)}} \]
  6. Step-by-step derivation
    1. associate-/r*99.8%

      \[\leadsto \color{blue}{\frac{\frac{y \cdot \frac{x}{y + x}}{y + \left(1 + x\right)}}{y + x}} \]
    2. associate-*l/99.8%

      \[\leadsto \frac{\color{blue}{\frac{y}{y + \left(1 + x\right)} \cdot \frac{x}{y + x}}}{y + x} \]
    3. *-commutative99.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + x} \cdot \frac{y}{y + \left(1 + x\right)}}}{y + x} \]
    4. associate-*r/99.8%

      \[\leadsto \frac{\color{blue}{\frac{\frac{x}{y + x} \cdot y}{y + \left(1 + x\right)}}}{y + x} \]
    5. *-commutative99.8%

      \[\leadsto \frac{\frac{\color{blue}{y \cdot \frac{x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
    6. associate-*r/75.3%

      \[\leadsto \frac{\frac{\color{blue}{\frac{y \cdot x}{y + x}}}{y + \left(1 + x\right)}}{y + x} \]
    7. +-commutative75.3%

      \[\leadsto \frac{\frac{\frac{y \cdot x}{y + x}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
  7. Simplified75.3%

    \[\leadsto \color{blue}{\frac{\frac{\frac{y \cdot x}{y + x}}{y + \left(x + 1\right)}}{y + x}} \]
  8. Taylor expanded in y around 0 49.4%

    \[\leadsto \frac{\frac{\color{blue}{y}}{y + \left(x + 1\right)}}{y + x} \]
  9. Taylor expanded in y around inf 4.1%

    \[\leadsto \color{blue}{\frac{1}{y}} \]
  10. Final simplification4.1%

    \[\leadsto \frac{1}{y} \]

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 2023257 
(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))))