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

Percentage Accurate: 68.3% → 99.8%
Time: 14.1s
Alternatives: 18
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 18 alternatives:

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

Initial Program: 68.3% 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, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.6% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y + \left(x + 1\right)\\ \mathbf{if}\;x \leq -1.56 \cdot 10^{+154}:\\ \;\;\;\;\frac{1 - \frac{y}{x}}{x + y} \cdot \frac{y}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x + y} \cdot \frac{y}{\left(x + y\right) \cdot t\_0}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (let* ((t_0 (+ y (+ x 1.0))))
   (if (<= x -1.56e+154)
     (* (/ (- 1.0 (/ y x)) (+ x y)) (/ y t_0))
     (* (/ x (+ x y)) (/ y (* (+ x y) t_0))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (x <= -1.56e+154) {
		tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
	} else {
		tmp = (x / (x + y)) * (y / ((x + y) * t_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 (x <= (-1.56d+154)) then
        tmp = ((1.0d0 - (y / x)) / (x + y)) * (y / t_0)
    else
        tmp = (x / (x + y)) * (y / ((x + y) * t_0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y + (x + 1.0);
	double tmp;
	if (x <= -1.56e+154) {
		tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
	} else {
		tmp = (x / (x + y)) * (y / ((x + y) * t_0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y + (x + 1.0)
	tmp = 0
	if x <= -1.56e+154:
		tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0)
	else:
		tmp = (x / (x + y)) * (y / ((x + y) * t_0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y + Float64(x + 1.0))
	tmp = 0.0
	if (x <= -1.56e+154)
		tmp = Float64(Float64(Float64(1.0 - Float64(y / x)) / Float64(x + y)) * Float64(y / t_0));
	else
		tmp = Float64(Float64(x / Float64(x + y)) * Float64(y / Float64(Float64(x + y) * t_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 (x <= -1.56e+154)
		tmp = ((1.0 - (y / x)) / (x + y)) * (y / t_0);
	else
		tmp = (x / (x + y)) * (y / ((x + y) * t_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[x, -1.56e+154], N[(N[(N[(1.0 - N[(y / x), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] * N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.56 \cdot 10^{+154}:\\
\;\;\;\;\frac{1 - \frac{y}{x}}{x + y} \cdot \frac{y}{t\_0}\\

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


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

    1. Initial program 57.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*57.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-frac75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55999999999999993e154 < x

    1. Initial program 70.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*70.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-frac96.4%

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

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

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

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

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

Alternative 3: 95.3% accurate, 0.8× speedup?

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

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


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

    1. Initial program 57.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*57.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-frac75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < x

    1. Initial program 70.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*70.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-frac96.4%

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

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

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

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

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

Alternative 4: 93.2% accurate, 0.8× speedup?

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

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


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

    1. Initial program 49.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*49.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-frac80.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.49999999999999974e118 < x

    1. Initial program 71.7%

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

        \[\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+83.6%

        \[\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*83.6%

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

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

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

        \[\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+94.6%

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

        \[\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+94.6%

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

      \[\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/94.6%

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

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

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

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

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

Alternative 5: 86.1% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -9.8 \cdot 10^{-68}:\\
\;\;\;\;\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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.4e154

    1. Initial program 57.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*57.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-frac75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.4e154 < x < -9.79999999999999954e-68

    1. Initial program 69.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*69.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-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. Taylor expanded in x around inf 72.7%

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

    if -9.79999999999999954e-68 < x

    1. Initial program 70.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. 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-frac96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.4 \cdot 10^{+154}:\\ \;\;\;\;\frac{1}{\left(x + y\right) \cdot \frac{x + \left(y + 1\right)}{y}}\\ \mathbf{elif}\;x \leq -9.8 \cdot 10^{-68}:\\ \;\;\;\;\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 6: 86.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := y + \left(x + 1\right)\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{y}{t\_0} \cdot \frac{1}{x + y}\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-68}:\\ \;\;\;\;\frac{y}{\left(x + y\right) \cdot t\_0}\\ \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 (<= x -1.35e+154)
     (* (/ y t_0) (/ 1.0 (+ x y)))
     (if (<= x -1.15e-68) (/ y (* (+ x y) t_0)) (/ (/ 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 (x <= -1.35e+154) {
		tmp = (y / t_0) * (1.0 / (x + y));
	} else if (x <= -1.15e-68) {
		tmp = y / ((x + y) * t_0);
	} else {
		tmp = (x / (x + y)) / (y + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: t_0
    real(8) :: tmp
    t_0 = y + (x + 1.0d0)
    if (x <= (-1.35d+154)) then
        tmp = (y / t_0) * (1.0d0 / (x + y))
    else if (x <= (-1.15d-68)) then
        tmp = y / ((x + y) * t_0)
    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 (x <= -1.35e+154) {
		tmp = (y / t_0) * (1.0 / (x + y));
	} else if (x <= -1.15e-68) {
		tmp = y / ((x + y) * t_0);
	} 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 x <= -1.35e+154:
		tmp = (y / t_0) * (1.0 / (x + y))
	elif x <= -1.15e-68:
		tmp = y / ((x + y) * t_0)
	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 (x <= -1.35e+154)
		tmp = Float64(Float64(y / t_0) * Float64(1.0 / Float64(x + y)));
	elseif (x <= -1.15e-68)
		tmp = Float64(y / Float64(Float64(x + y) * t_0));
	else
		tmp = Float64(Float64(x / Float64(x + y)) / Float64(y + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y + (x + 1.0);
	tmp = 0.0;
	if (x <= -1.35e+154)
		tmp = (y / t_0) * (1.0 / (x + y));
	elseif (x <= -1.15e-68)
		tmp = y / ((x + y) * t_0);
	else
		tmp = (x / (x + y)) / (y + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.35e+154], N[(N[(y / t$95$0), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.15e-68], N[(y / N[(N[(x + y), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := y + \left(x + 1\right)\\
\mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;\frac{y}{t\_0} \cdot \frac{1}{x + y}\\

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

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


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

    1. Initial program 57.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*57.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-frac75.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.35000000000000003e154 < x < -1.14999999999999998e-68

    1. Initial program 69.7%

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

        \[\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. Taylor expanded in x around inf 71.4%

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

    if -1.14999999999999998e-68 < x

    1. Initial program 70.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*70.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-frac96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.35 \cdot 10^{+154}:\\ \;\;\;\;\frac{y}{y + \left(x + 1\right)} \cdot \frac{1}{x + y}\\ \mathbf{elif}\;x \leq -1.15 \cdot 10^{-68}:\\ \;\;\;\;\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 7: 86.3% accurate, 0.8× speedup?

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

\mathbf{elif}\;x \leq -6 \cdot 10^{-69}:\\
\;\;\;\;\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}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.25000000000000001e154

    1. Initial program 57.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. +-commutative57.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.25000000000000001e154 < x < -5.99999999999999978e-69

    1. Initial program 69.7%

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

        \[\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. Taylor expanded in x around inf 71.4%

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

    if -5.99999999999999978e-69 < x

    1. Initial program 70.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*70.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-frac96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.25 \cdot 10^{+154}:\\ \;\;\;\;\frac{y}{x + y} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -6 \cdot 10^{-69}:\\ \;\;\;\;\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 8: 92.5% accurate, 0.8× speedup?

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

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


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

    1. Initial program 58.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2200 < x

    1. Initial program 71.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 10: 83.0% accurate, 1.1× speedup?

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

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


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

    1. Initial program 65.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*65.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-frac88.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3e-68 < x

    1. Initial program 70.1%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. associate-*l*70.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-frac96.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 11: 82.9% accurate, 1.2× speedup?

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

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


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

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.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+78.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. Simplified78.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. Taylor expanded in y around 0 64.6%

      \[\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}} \]

    if -6.1999999999999995e-66 < x

    1. Initial program 70.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. 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-frac96.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 12: 83.0% accurate, 1.4× speedup?

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

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


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

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.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+78.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. Simplified78.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. Taylor expanded in y around 0 64.6%

      \[\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}} \]

    if -8.8000000000000004e-66 < x

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 80.6% accurate, 1.4× speedup?

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

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


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

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.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+78.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. Simplified78.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. Taylor expanded in y around 0 64.6%

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

    if -3.0999999999999997e-66 < x

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 79.2% accurate, 1.4× speedup?

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

    1. Initial program 65.0%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*78.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+78.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. Simplified78.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. Taylor expanded in y around 0 64.6%

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

    if -3.0999999999999997e-66 < x

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

Alternative 15: 28.5% accurate, 1.7× speedup?

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

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


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

    1. Initial program 58.7%

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

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

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

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

        \[\leadsto \frac{x}{y + x} \cdot \frac{y}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      6. +-commutative85.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+85.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-rr85.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 x around 0 33.4%

      \[\leadsto \color{blue}{\frac{x}{y}} \cdot \frac{y}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
    6. Taylor expanded in y around 0 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}} \]

    if -2250 < x

    1. Initial program 71.7%

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

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

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

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

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

Alternative 16: 49.8% accurate, 2.4× speedup?

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

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

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

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

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

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

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

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

Alternative 17: 27.0% accurate, 5.7× speedup?

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

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

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

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

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

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

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

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

    \[\leadsto \frac{x}{\color{blue}{y}} \]
  9. Add Preprocessing

Alternative 18: 3.0% accurate, 5.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ 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])\\
\\
1 - x
\end{array}
Derivation
  1. Initial program 68.7%

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

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

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

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

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

    \[\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 x around 0 61.9%

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

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

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

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

    \[\leadsto \color{blue}{1 + -1 \cdot x} \]
  10. Step-by-step derivation
    1. neg-mul-13.2%

      \[\leadsto 1 + \color{blue}{\left(-x\right)} \]
    2. sub-neg3.2%

      \[\leadsto \color{blue}{1 - x} \]
  11. Simplified3.2%

    \[\leadsto \color{blue}{1 - x} \]
  12. 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 2024088 
(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))))