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

Percentage Accurate: 69.0% → 99.8%
Time: 21.0s
Alternatives: 18
Speedup: 1.0×

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: 69.0% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 95.4% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -5 \cdot 10^{+24}:\\
\;\;\;\;\frac{y}{t\_0}\\

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

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


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

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.79999999999999996e163 < x < -5.00000000000000045e24

    1. Initial program 43.5%

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

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

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

      \[\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. associate-*r/43.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000045e24 < x < -8.2000000000000004e-14

    1. Initial program 99.2%

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

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

    if -8.2000000000000004e-14 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 79.2% accurate, 0.6× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+74}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{-24}:\\ \;\;\;\;\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
 (let* ((t_0 (* (/ y x) (/ 1.0 x))))
   (if (<= x -1.7e+100)
     t_0
     (if (<= x -3.6e+93)
       (/ x (* y (+ y x)))
       (if (<= x -5e+74)
         t_0
         (if (<= x -6.5e-24) (/ y (* x (+ x 1.0))) (/ x (* y (+ y 1.0)))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = (y / x) * (1.0 / x);
	double tmp;
	if (x <= -1.7e+100) {
		tmp = t_0;
	} else if (x <= -3.6e+93) {
		tmp = x / (y * (y + x));
	} else if (x <= -5e+74) {
		tmp = t_0;
	} else if (x <= -6.5e-24) {
		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) :: t_0
    real(8) :: tmp
    t_0 = (y / x) * (1.0d0 / x)
    if (x <= (-1.7d+100)) then
        tmp = t_0
    else if (x <= (-3.6d+93)) then
        tmp = x / (y * (y + x))
    else if (x <= (-5d+74)) then
        tmp = t_0
    else if (x <= (-6.5d-24)) 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 t_0 = (y / x) * (1.0 / x);
	double tmp;
	if (x <= -1.7e+100) {
		tmp = t_0;
	} else if (x <= -3.6e+93) {
		tmp = x / (y * (y + x));
	} else if (x <= -5e+74) {
		tmp = t_0;
	} else if (x <= -6.5e-24) {
		tmp = y / (x * (x + 1.0));
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = (y / x) * (1.0 / x)
	tmp = 0
	if x <= -1.7e+100:
		tmp = t_0
	elif x <= -3.6e+93:
		tmp = x / (y * (y + x))
	elif x <= -5e+74:
		tmp = t_0
	elif x <= -6.5e-24:
		tmp = y / (x * (x + 1.0))
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(Float64(y / x) * Float64(1.0 / x))
	tmp = 0.0
	if (x <= -1.7e+100)
		tmp = t_0;
	elseif (x <= -3.6e+93)
		tmp = Float64(x / Float64(y * Float64(y + x)));
	elseif (x <= -5e+74)
		tmp = t_0;
	elseif (x <= -6.5e-24)
		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)
	t_0 = (y / x) * (1.0 / x);
	tmp = 0.0;
	if (x <= -1.7e+100)
		tmp = t_0;
	elseif (x <= -3.6e+93)
		tmp = x / (y * (y + x));
	elseif (x <= -5e+74)
		tmp = t_0;
	elseif (x <= -6.5e-24)
		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_] := Block[{t$95$0 = N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.7e+100], t$95$0, If[LessEqual[x, -3.6e+93], N[(x / N[(y * N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -5e+74], t$95$0, If[LessEqual[x, -6.5e-24], 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}
t_0 := \frac{y}{x} \cdot \frac{1}{x}\\
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -5 \cdot 10^{+74}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -1.69999999999999997e100 or -3.5999999999999999e93 < x < -4.99999999999999963e74

    1. Initial program 53.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity53.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999997e100 < x < -3.5999999999999999e93

    1. Initial program 4.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999963e74 < x < -6.5e-24

    1. Initial program 88.8%

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

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

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

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

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

    if -6.5e-24 < x

    1. Initial program 74.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -3.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + x\right)}\\ \mathbf{elif}\;x \leq -5 \cdot 10^{+74}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -6.5 \cdot 10^{-24}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 94.5% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 60.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*80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.40000000000000008e158 < x < -8.5e26

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.5e26 < x

    1. Initial program 75.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*86.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 94.1% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.39999999999999998e163 < x < -5e6

    1. Initial program 52.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5e6 < x

    1. Initial program 74.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*86.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+86.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. Simplified86.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. Step-by-step derivation
      1. associate-*r/74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 94.5% accurate, 0.7× speedup?

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

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

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


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

    1. Initial program 60.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*80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.40000000000000008e158 < x < -1350

    1. Initial program 53.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1350 < x

    1. Initial program 74.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*86.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+86.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. Simplified86.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. Step-by-step derivation
      1. associate-*r/74.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 83.0% accurate, 0.7× speedup?

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

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

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

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


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

    1. Initial program 60.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*80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.17999999999999999e160 < x < -8.99999999999999957e26

    1. Initial program 45.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.99999999999999957e26 < x < -6.20000000000000033e-48

    1. Initial program 91.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.20000000000000033e-48 < x

    1. Initial program 74.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 77.9% accurate, 0.8× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -1.69999999999999997e100 or -3.5999999999999999e93 < x < -8.2e8

    1. Initial program 61.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. *-un-lft-identity61.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999997e100 < x < -3.5999999999999999e93 or -8.2e8 < x

    1. Initial program 73.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*85.8%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100} \lor \neg \left(x \leq -3.6 \cdot 10^{+93}\right) \land x \leq -820000000:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 80.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+92} \lor \neg \left(x \leq -1.55 \cdot 10^{-23}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.7e+100)
   (* (/ y x) (/ 1.0 x))
   (if (or (<= x -4.5e+92) (not (<= x -1.55e-23)))
     (/ (/ x y) (+ y 1.0))
     (/ y (* x (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.7e+100) {
		tmp = (y / x) * (1.0 / x);
	} else if ((x <= -4.5e+92) || !(x <= -1.55e-23)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (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.7d+100)) then
        tmp = (y / x) * (1.0d0 / x)
    else if ((x <= (-4.5d+92)) .or. (.not. (x <= (-1.55d-23)))) then
        tmp = (x / y) / (y + 1.0d0)
    else
        tmp = y / (x * (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.7e+100) {
		tmp = (y / x) * (1.0 / x);
	} else if ((x <= -4.5e+92) || !(x <= -1.55e-23)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (x + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.7e+100:
		tmp = (y / x) * (1.0 / x)
	elif (x <= -4.5e+92) or not (x <= -1.55e-23):
		tmp = (x / y) / (y + 1.0)
	else:
		tmp = y / (x * (x + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.7e+100)
		tmp = Float64(Float64(y / x) * Float64(1.0 / x));
	elseif ((x <= -4.5e+92) || !(x <= -1.55e-23))
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	else
		tmp = Float64(y / Float64(x * 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.7e+100)
		tmp = (y / x) * (1.0 / x);
	elseif ((x <= -4.5e+92) || ~((x <= -1.55e-23)))
		tmp = (x / y) / (y + 1.0);
	else
		tmp = y / (x * (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.7e+100], N[(N[(y / x), $MachinePrecision] * N[(1.0 / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -4.5e+92], N[Not[LessEqual[x, -1.55e-23]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\

\mathbf{elif}\;x \leq -4.5 \cdot 10^{+92} \lor \neg \left(x \leq -1.55 \cdot 10^{-23}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\

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


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

    1. Initial program 50.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999997e100 < x < -4.4999999999999999e92 or -1.5499999999999999e-23 < x

    1. Initial program 73.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*85.9%

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

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

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

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

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

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

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

    if -4.4999999999999999e92 < x < -1.5499999999999999e-23

    1. Initial program 90.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+80.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. Simplified80.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 y around 0 77.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;\frac{y}{x} \cdot \frac{1}{x}\\ \mathbf{elif}\;x \leq -4.5 \cdot 10^{+92} \lor \neg \left(x \leq -1.55 \cdot 10^{-23}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 80.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{+91} \lor \neg \left(x \leq -1.75 \cdot 10^{-25}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= x -1.7e+100)
   (/ (/ y x) (+ y x))
   (if (or (<= x -5.8e+91) (not (<= x -1.75e-25)))
     (/ (/ x y) (+ y 1.0))
     (/ y (* x (+ x 1.0))))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -1.7e+100) {
		tmp = (y / x) / (y + x);
	} else if ((x <= -5.8e+91) || !(x <= -1.75e-25)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (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.7d+100)) then
        tmp = (y / x) / (y + x)
    else if ((x <= (-5.8d+91)) .or. (.not. (x <= (-1.75d-25)))) then
        tmp = (x / y) / (y + 1.0d0)
    else
        tmp = y / (x * (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.7e+100) {
		tmp = (y / x) / (y + x);
	} else if ((x <= -5.8e+91) || !(x <= -1.75e-25)) {
		tmp = (x / y) / (y + 1.0);
	} else {
		tmp = y / (x * (x + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -1.7e+100:
		tmp = (y / x) / (y + x)
	elif (x <= -5.8e+91) or not (x <= -1.75e-25):
		tmp = (x / y) / (y + 1.0)
	else:
		tmp = y / (x * (x + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -1.7e+100)
		tmp = Float64(Float64(y / x) / Float64(y + x));
	elseif ((x <= -5.8e+91) || !(x <= -1.75e-25))
		tmp = Float64(Float64(x / y) / Float64(y + 1.0));
	else
		tmp = Float64(y / Float64(x * 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.7e+100)
		tmp = (y / x) / (y + x);
	elseif ((x <= -5.8e+91) || ~((x <= -1.75e-25)))
		tmp = (x / y) / (y + 1.0);
	else
		tmp = y / (x * (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.7e+100], N[(N[(y / x), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -5.8e+91], N[Not[LessEqual[x, -1.75e-25]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] / N[(y + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\
\;\;\;\;\frac{\frac{y}{x}}{y + x}\\

\mathbf{elif}\;x \leq -5.8 \cdot 10^{+91} \lor \neg \left(x \leq -1.75 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{\frac{x}{y}}{y + 1}\\

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


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

    1. Initial program 50.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.69999999999999997e100 < x < -5.80000000000000028e91 or -1.7500000000000001e-25 < x

    1. Initial program 73.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*85.9%

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

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

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

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

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

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

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

    if -5.80000000000000028e91 < x < -1.7500000000000001e-25

    1. Initial program 90.6%

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

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+80.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. Simplified80.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 y around 0 77.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.7 \cdot 10^{+100}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -5.8 \cdot 10^{+91} \lor \neg \left(x \leq -1.75 \cdot 10^{-25}\right):\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 77.9% accurate, 0.8× speedup?

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

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

\mathbf{elif}\;x \leq -3200000:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if x < -1.95e100 or -1.25e93 < x < -3.2e6

    1. Initial program 61.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. *-un-lft-identity61.0%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.95e100 < x < -1.25e93

    1. Initial program 4.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.2e6 < x

    1. Initial program 74.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*86.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+86.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. Simplified86.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 59.7%

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

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

Alternative 12: 82.0% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 60.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.99999999999999987e148 < x < -9.50000000000000054e26

    1. Initial program 44.5%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-un-lft-identity44.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.50000000000000054e26 < x < -1.1599999999999999e-23

    1. Initial program 92.6%

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

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

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

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

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

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

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

    if -1.1599999999999999e-23 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

Alternative 13: 82.9% accurate, 0.8× speedup?

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

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

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

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


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

    1. Initial program 60.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*80.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.80000000000000021e161 < x < -1.55e12

    1. Initial program 50.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.55e12 < x < -1.3e-22

    1. Initial program 89.2%

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

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

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

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

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

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

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

    if -1.3e-22 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

Alternative 14: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 61.4% accurate, 1.4× speedup?

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

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


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

    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. *-un-lft-identity57.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -1 < x

    1. Initial program 74.5%

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

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

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

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

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

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

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

Alternative 16: 4.3% accurate, 5.7× speedup?

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

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. *-un-lft-identity70.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{1}{x}} \]
  7. Final simplification4.0%

    \[\leadsto \frac{1}{x} \]
  8. Add Preprocessing

Alternative 17: 25.8% accurate, 5.7× speedup?

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  7. Final simplification29.3%

    \[\leadsto \frac{x}{y} \]
  8. Add Preprocessing

Alternative 18: 3.4% accurate, 8.5× speedup?

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{x}{y} - x} \]
  8. Simplified16.6%

    \[\leadsto \color{blue}{\frac{x}{y} - x} \]
  9. Taylor expanded in y around inf 3.8%

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

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

    \[\leadsto \color{blue}{-x} \]
  12. Final simplification3.8%

    \[\leadsto -x \]
  13. 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 2024053 
(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))))