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

Percentage Accurate: 69.7% → 99.8%
Time: 18.1s
Alternatives: 16
Speedup: 1.4×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 90.7% accurate, 0.5× speedup?

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

\mathbf{elif}\;y \leq 7.8 \cdot 10^{-207}:\\
\;\;\;\;t\_0 \cdot \frac{\frac{y}{y + 1}}{x + y}\\

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

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


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

    1. Initial program 69.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2000000000000002e-261 < y < 7.80000000000000042e-207

    1. Initial program 60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 7.80000000000000042e-207 < y < 8.6000000000000006e29

    1. Initial program 84.9%

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

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

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

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

    if 8.6000000000000006e29 < y

    1. Initial program 66.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 95.4% accurate, 0.6× speedup?

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

\mathbf{elif}\;y \leq 6.2 \cdot 10^{+74}:\\
\;\;\;\;t\_0 \cdot \frac{y}{\left(x + y\right) \cdot t\_1}\\

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


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

    1. Initial program 53.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999979e124 < y < 6.20000000000000043e74

    1. Initial program 76.4%

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

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

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

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

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

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

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

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

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

    if 6.20000000000000043e74 < y

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 94.2% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.00000000000000038e-133 < y < 6.20000000000000043e74

    1. Initial program 73.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*84.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. associate-+l+84.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 6.20000000000000043e74 < y

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 81.2% accurate, 0.7× speedup?

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

\mathbf{elif}\;x \leq -1.55 \cdot 10^{-183}:\\
\;\;\;\;\frac{x}{y}\\

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

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


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

    1. Initial program 66.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.19999999999999984e-151 < x < -1.55e-183

    1. Initial program 99.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*98.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. associate-+l+98.4%

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

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

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

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

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

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

    if -1.55e-183 < x < -1.05e-188

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \frac{1}{\frac{1 \cdot x + \color{blue}{x \cdot x}}{y}} \]
      4. distribute-rgt-in24.3%

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

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

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

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

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

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

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

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

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

    if -1.05e-188 < x

    1. Initial program 72.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 91.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8e16 < x

    1. Initial program 73.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 81.9% accurate, 0.9× speedup?

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

\mathbf{elif}\;x \leq -8.5 \cdot 10^{-246}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y}\\

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


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

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*80.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. associate-+l+80.8%

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

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

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

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

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

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

    if -1.0199999999999999e-150 < x < -8.4999999999999998e-246

    1. Initial program 83.2%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*83.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. associate-+l+83.4%

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

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

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

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

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

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

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

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

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

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

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

    if -8.4999999999999998e-246 < x

    1. Initial program 71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 43.7% accurate, 0.9× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-151} \lor \neg \left(x \leq -1.75 \cdot 10^{-245}\right) \land x \leq -1.7 \cdot 10^{-245}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (or (<= x -8.2e-151) (and (not (<= x -1.75e-245)) (<= x -1.7e-245)))
   (/ y x)
   (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245))) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if ((x <= (-8.2d-151)) .or. (.not. (x <= (-1.75d-245))) .and. (x <= (-1.7d-245))) then
        tmp = y / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245))) {
		tmp = y / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if (x <= -8.2e-151) or (not (x <= -1.75e-245) and (x <= -1.7e-245)):
		tmp = y / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if ((x <= -8.2e-151) || (!(x <= -1.75e-245) && (x <= -1.7e-245)))
		tmp = Float64(y / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if ((x <= -8.2e-151) || (~((x <= -1.75e-245)) && (x <= -1.7e-245)))
		tmp = y / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[Or[LessEqual[x, -8.2e-151], And[N[Not[LessEqual[x, -1.75e-245]], $MachinePrecision], LessEqual[x, -1.7e-245]]], N[(y / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8.2 \cdot 10^{-151} \lor \neg \left(x \leq -1.75 \cdot 10^{-245}\right) \land x \leq -1.7 \cdot 10^{-245}:\\
\;\;\;\;\frac{y}{x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -8.2000000000000002e-151 or -1.75000000000000008e-245 < x < -1.7e-245

    1. Initial program 65.9%

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

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

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

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

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

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

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

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

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

    if -8.2000000000000002e-151 < x < -1.75000000000000008e-245 or -1.7e-245 < x

    1. Initial program 73.1%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.2 \cdot 10^{-151} \lor \neg \left(x \leq -1.75 \cdot 10^{-245}\right) \land x \leq -1.7 \cdot 10^{-245}:\\ \;\;\;\;\frac{y}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 82.4% accurate, 1.1× speedup?

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

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


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

    1. Initial program 66.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.09999999999999977e-141 < x

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 82.3% accurate, 1.4× speedup?

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

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

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

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

    if -1.15000000000000006e-124 < x

    1. Initial program 71.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*83.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. associate-+l+83.4%

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 80.0% accurate, 1.4× speedup?

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

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


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

    1. Initial program 66.9%

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

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

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

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

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

    if -5.4000000000000005e-141 < x

    1. Initial program 72.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 78.7% accurate, 1.4× speedup?

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

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


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

    1. Initial program 67.6%

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

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

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

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

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

    if -1.15000000000000006e-124 < x

    1. Initial program 71.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*83.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. associate-+l+83.4%

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

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

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

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

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

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

Alternative 13: 66.2% accurate, 1.4× speedup?

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

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


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

    1. Initial program 67.2%

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

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

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

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

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

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

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

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

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

    if 2.90000000000000021e-156 < y

    1. Initial program 75.2%

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

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

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

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

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

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

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

Alternative 14: 27.8% accurate, 2.1× speedup?

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

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


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

    1. Initial program 58.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{1}{\color{blue}{x + 1}} \]
    8. Simplified6.2%

      \[\leadsto \color{blue}{\frac{1}{x + 1}} \]
    9. Taylor expanded in x around inf 6.2%

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

    if -9.0000000000000001e34 < x

    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-/l*84.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. associate-+l+84.8%

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

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

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

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

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

      \[\leadsto \frac{x}{\color{blue}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 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.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{x + 1}} \]
  8. Simplified4.7%

    \[\leadsto \color{blue}{\frac{1}{x + 1}} \]
  9. Taylor expanded in x around inf 4.1%

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  10. Add Preprocessing

Alternative 16: 3.4% accurate, 17.0× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ 1 \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 1.0)
assert(x < y);
double code(double x, double y) {
	return 1.0;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    code = 1.0d0
end function
assert x < y;
public static double code(double x, double y) {
	return 1.0;
}
[x, y] = sort([x, y])
def code(x, y):
	return 1.0
x, y = sort([x, y])
function code(x, y)
	return 1.0
end
x, y = num2cell(sort([x, y])){:}
function tmp = code(x, y)
	tmp = 1.0;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := 1.0
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
1
\end{array}
Derivation
  1. Initial program 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. Add Preprocessing
  3. Step-by-step derivation
    1. associate-*l*70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{1} \]
  15. Add Preprocessing

Developer target: 99.8% accurate, 0.9× speedup?

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

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

Reproduce

?
herbie shell --seed 2024107 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :alt
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))