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

Percentage Accurate: 69.8% → 99.8%
Time: 22.9s
Alternatives: 21
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 21 alternatives:

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

Initial Program: 69.8% accurate, 1.0× speedup?

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

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

Alternative 1: 99.8% accurate, 1.0× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 78.6% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -38000000:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\

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

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

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

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.0000000000000001e57 < x < -3.8e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.8e7 < x < -1.30000000000000005e-38

    1. Initial program 99.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*100.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+100.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. Simplified100.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/99.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+99.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. clear-num99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.30000000000000005e-38 < x < -1.8999999999999999e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.8999999999999999e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2 \cdot 10^{+57}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\ \mathbf{elif}\;x \leq -38000000:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-38}:\\ \;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\ \mathbf{elif}\;x \leq -1.9 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{1}{x + 1} \cdot \frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 75.1% accurate, 0.5× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{if}\;x \leq -2.65 \cdot 10^{+57}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -35000000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -2.15 \cdot 10^{-38}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{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 (+ x 1.0)))))
   (if (<= x -2.65e+57)
     t_0
     (if (<= x -35000000.0)
       (/ (/ x y) (+ y x))
       (if (<= x -2.15e-38)
         t_0
         (if (or (<= x -1.2e-85) (not (<= x -4.1e-153)))
           (/ x (* y (+ y 1.0)))
           (/ y (+ y x))))))))
assert(x < y);
double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -2.65e+57) {
		tmp = t_0;
	} else if (x <= -35000000.0) {
		tmp = (x / y) / (y + x);
	} else if (x <= -2.15e-38) {
		tmp = t_0;
	} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = y / (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 * (x + 1.0d0))
    if (x <= (-2.65d+57)) then
        tmp = t_0
    else if (x <= (-35000000.0d0)) then
        tmp = (x / y) / (y + x)
    else if (x <= (-2.15d-38)) then
        tmp = t_0
    else if ((x <= (-1.2d-85)) .or. (.not. (x <= (-4.1d-153)))) then
        tmp = x / (y * (y + 1.0d0))
    else
        tmp = y / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double t_0 = y / (x * (x + 1.0));
	double tmp;
	if (x <= -2.65e+57) {
		tmp = t_0;
	} else if (x <= -35000000.0) {
		tmp = (x / y) / (y + x);
	} else if (x <= -2.15e-38) {
		tmp = t_0;
	} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = y / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	t_0 = y / (x * (x + 1.0))
	tmp = 0
	if x <= -2.65e+57:
		tmp = t_0
	elif x <= -35000000.0:
		tmp = (x / y) / (y + x)
	elif x <= -2.15e-38:
		tmp = t_0
	elif (x <= -1.2e-85) or not (x <= -4.1e-153):
		tmp = x / (y * (y + 1.0))
	else:
		tmp = y / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	t_0 = Float64(y / Float64(x * Float64(x + 1.0)))
	tmp = 0.0
	if (x <= -2.65e+57)
		tmp = t_0;
	elseif (x <= -35000000.0)
		tmp = Float64(Float64(x / y) / Float64(y + x));
	elseif (x <= -2.15e-38)
		tmp = t_0;
	elseif ((x <= -1.2e-85) || !(x <= -4.1e-153))
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	else
		tmp = Float64(y / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	t_0 = y / (x * (x + 1.0));
	tmp = 0.0;
	if (x <= -2.65e+57)
		tmp = t_0;
	elseif (x <= -35000000.0)
		tmp = (x / y) / (y + x);
	elseif (x <= -2.15e-38)
		tmp = t_0;
	elseif ((x <= -1.2e-85) || ~((x <= -4.1e-153)))
		tmp = x / (y * (y + 1.0));
	else
		tmp = y / (y + x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := Block[{t$95$0 = N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -2.65e+57], t$95$0, If[LessEqual[x, -35000000.0], N[(N[(x / y), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.15e-38], t$95$0, If[Or[LessEqual[x, -1.2e-85], N[Not[LessEqual[x, -4.1e-153]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
t_0 := \frac{y}{x \cdot \left(x + 1\right)}\\
\mathbf{if}\;x \leq -2.65 \cdot 10^{+57}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -35000000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

\mathbf{elif}\;x \leq -2.15 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if x < -2.64999999999999993e57 or -3.5e7 < x < -2.1500000000000001e-38

    1. Initial program 58.4%

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

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

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

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

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

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

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

    if -2.64999999999999993e57 < x < -3.5e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.1500000000000001e-38 < x < -1.2e-85 or -4.1e-153 < x

    1. Initial program 66.0%

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

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

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

    if -1.2e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.65 \cdot 10^{+57}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -35000000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -2.15 \cdot 10^{-38}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 76.4% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -15200000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

\mathbf{elif}\;x \leq -1.7 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if x < -1.5e57 or -1.52e7 < x < -1.7000000000000001e-38

    1. Initial program 58.4%

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

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

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

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

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

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

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

    if -1.5e57 < x < -1.52e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.7000000000000001e-38 < x < -1.2e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.2e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{+57}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -15200000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -1.7 \cdot 10^{-38}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 78.5% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -14500000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

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

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1499999999999999e57 < x < -1.45e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.45e7 < x < -2.25000000000000004e-38

    1. Initial program 99.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*100.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+100.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. Simplified100.0%

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

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

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

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

    if -2.25000000000000004e-38 < x < -1.2e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.2e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+57}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;x \leq -14500000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 78.6% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -20500000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

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

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.46e57 < x < -2.05e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.05e7 < x < -2.25000000000000004e-38

    1. Initial program 99.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*100.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+100.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. Simplified100.0%

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

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

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

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

    if -2.25000000000000004e-38 < x < -1.25e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.25e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.46 \cdot 10^{+57}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -20500000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.25 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 78.6% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -15800000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

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

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -8.4999999999999998e56 < x < -1.58e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.58e7 < x < -1.01999999999999998e-38

    1. Initial program 99.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*100.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+100.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. Simplified100.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/99.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+99.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. clear-num99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.01999999999999998e-38 < x < -1.64999999999999986e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.64999999999999986e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8.5 \cdot 10^{+56}:\\ \;\;\;\;\frac{\frac{y}{x}}{y + x}\\ \mathbf{elif}\;x \leq -15800000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -1.02 \cdot 10^{-38}:\\ \;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\ \mathbf{elif}\;x \leq -1.65 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 78.5% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -30000000:\\
\;\;\;\;\frac{\frac{x}{y}}{y + x}\\

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

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1499999999999999e57 < x < -3e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3e7 < x < -7.49999999999999971e-39

    1. Initial program 99.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*100.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+100.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. Simplified100.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/99.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+99.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. clear-num99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.49999999999999971e-39 < x < -1.40000000000000008e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.40000000000000008e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1.15 \cdot 10^{+57}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\ \mathbf{elif}\;x \leq -30000000:\\ \;\;\;\;\frac{\frac{x}{y}}{y + x}\\ \mathbf{elif}\;x \leq -7.5 \cdot 10^{-39}:\\ \;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\ \mathbf{elif}\;x \leq -1.4 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 78.6% accurate, 0.5× speedup?

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

\mathbf{elif}\;x \leq -59000000:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\

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

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

\mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\
\;\;\;\;\frac{y}{y + x}\\

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000005e57 < x < -5.9e7

    1. Initial program 80.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.9e7 < x < -2.25000000000000004e-38

    1. Initial program 99.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*100.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+100.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. Simplified100.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/99.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+99.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. clear-num99.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.25000000000000004e-38 < x < -1.2e-85

    1. Initial program 93.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*93.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+93.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. Simplified93.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 77.2%

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

    if -1.2e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1e-153 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.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. Taylor expanded in x around 0 59.5%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{+57}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x}}{y + x}\\ \mathbf{elif}\;x \leq -59000000:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \mathbf{elif}\;x \leq -2.25 \cdot 10^{-38}:\\ \;\;\;\;\frac{1}{x \cdot \frac{x + 1}{y}}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{elif}\;x \leq -4.1 \cdot 10^{-153}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y}}{y + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.2% accurate, 0.5× speedup?

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

\mathbf{elif}\;y \leq 1.24 \cdot 10^{-147}:\\
\;\;\;\;\frac{x}{y}\\

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

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

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


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

    1. Initial program 62.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 1.57999999999999994e-158 < y < 1.2400000000000001e-147

    1. Initial program 28.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*90.1%

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

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

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

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

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

    if 1.2400000000000001e-147 < y < 1.4500000000000001e-8

    1. Initial program 85.2%

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

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

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

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

    if 1.4500000000000001e-8 < y < 1.80000000000000008e132

    1. Initial program 64.1%

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

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

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

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

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

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

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

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

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

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

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

    if 1.80000000000000008e132 < y

    1. Initial program 68.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \log \color{blue}{\left(1 + \left(y + x\right)\right)}} \]
      8. log1p-define75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \color{blue}{\mathsf{log1p}\left(y + x\right)}} \]
      9. +-commutative75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \mathsf{log1p}\left(\color{blue}{x + y}\right)} \]
    7. Applied egg-rr75.0%

      \[\leadsto 1 \cdot \color{blue}{e^{\log \left(\frac{x}{x + y}\right) - \mathsf{log1p}\left(x + y\right)}} \]
    8. Step-by-step derivation
      1. exp-diff74.9%

        \[\leadsto 1 \cdot \color{blue}{\frac{e^{\log \left(\frac{x}{x + y}\right)}}{e^{\mathsf{log1p}\left(x + y\right)}}} \]
      2. rem-exp-log90.1%

        \[\leadsto 1 \cdot \frac{\color{blue}{\frac{x}{x + y}}}{e^{\mathsf{log1p}\left(x + y\right)}} \]
      3. log1p-undefine90.1%

        \[\leadsto 1 \cdot \frac{\frac{x}{x + y}}{e^{\color{blue}{\log \left(1 + \left(x + y\right)\right)}}} \]
      4. rem-exp-log91.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 1.24 \cdot 10^{-147}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-8}:\\ \;\;\;\;\frac{y \cdot x}{\left(x + 1\right) \cdot \left(\left(y + x\right) \cdot \left(y + x\right)\right)}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 91.2% accurate, 0.6× speedup?

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

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

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.20000000000000024e58 < x < -8.1999999999999995e-166

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

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

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

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

    if -8.1999999999999995e-166 < x

    1. Initial program 63.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*76.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+76.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. Simplified76.2%

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

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

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

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

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

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

Alternative 12: 77.3% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{-39}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{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 -8e-39)
   (/ y (* x (+ x 1.0)))
   (if (or (<= x -1.2e-85) (not (<= x -4.1e-153)))
     (/ x (* y (+ y 1.0)))
     (/ y (+ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -8e-39) {
		tmp = y / (x * (x + 1.0));
	} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = y / (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 <= (-8d-39)) then
        tmp = y / (x * (x + 1.0d0))
    else if ((x <= (-1.2d-85)) .or. (.not. (x <= (-4.1d-153)))) then
        tmp = x / (y * (y + 1.0d0))
    else
        tmp = y / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -8e-39) {
		tmp = y / (x * (x + 1.0));
	} else if ((x <= -1.2e-85) || !(x <= -4.1e-153)) {
		tmp = x / (y * (y + 1.0));
	} else {
		tmp = y / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -8e-39:
		tmp = y / (x * (x + 1.0))
	elif (x <= -1.2e-85) or not (x <= -4.1e-153):
		tmp = x / (y * (y + 1.0))
	else:
		tmp = y / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -8e-39)
		tmp = Float64(y / Float64(x * Float64(x + 1.0)));
	elseif ((x <= -1.2e-85) || !(x <= -4.1e-153))
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	else
		tmp = Float64(y / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -8e-39)
		tmp = y / (x * (x + 1.0));
	elseif ((x <= -1.2e-85) || ~((x <= -4.1e-153)))
		tmp = x / (y * (y + 1.0));
	else
		tmp = y / (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, -8e-39], N[(y / N[(x * N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, -1.2e-85], N[Not[LessEqual[x, -4.1e-153]], $MachinePrecision]], N[(x / N[(y * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-39}:\\
\;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\

\mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\

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


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

    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*74.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+74.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. Simplified74.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 76.6%

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

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

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

    if -7.99999999999999943e-39 < x < -1.2e-85 or -4.1e-153 < x

    1. Initial program 66.0%

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

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

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

    if -1.2e-85 < x < -4.1e-153

    1. Initial program 79.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -8 \cdot 10^{-39}:\\ \;\;\;\;\frac{y}{x \cdot \left(x + 1\right)}\\ \mathbf{elif}\;x \leq -1.2 \cdot 10^{-85} \lor \neg \left(x \leq -4.1 \cdot 10^{-153}\right):\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 93.7% accurate, 0.8× speedup?

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

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


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

    1. Initial program 52.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. *-commutative52.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.5000000000000001e58 < x

    1. Initial program 68.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*80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 95.9% accurate, 0.8× speedup?

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

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


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

    1. Initial program 57.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. *-commutative57.0%

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

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

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative85.8%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative85.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+85.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative85.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+85.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr85.8%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/85.8%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.9%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.9%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.9%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in x around inf 93.2%

      \[\leadsto \frac{y \cdot \frac{\color{blue}{1}}{x + \left(y + 1\right)}}{x + y} \]

    if -2.5999999999999999e143 < x

    1. Initial program 66.6%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative66.6%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*66.6%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac94.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative94.9%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative94.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+94.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative94.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+94.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr94.9%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification94.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -2.6 \cdot 10^{+143}:\\ \;\;\;\;\frac{y \cdot \frac{1}{x + \left(y + 1\right)}}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)} \cdot \frac{y}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 86.4% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+77}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 1.58e-158)
   (/ (/ y x) (+ x 1.0))
   (if (<= y 3e+77)
     (/ x (* (+ y x) (+ y (+ x 1.0))))
     (/ (/ x (+ y 1.0)) (+ y x)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.58e-158) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 3e+77) {
		tmp = x / ((y + x) * (y + (x + 1.0)));
	} else {
		tmp = (x / (y + 1.0)) / (y + x);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.58d-158) then
        tmp = (y / x) / (x + 1.0d0)
    else if (y <= 3d+77) then
        tmp = x / ((y + x) * (y + (x + 1.0d0)))
    else
        tmp = (x / (y + 1.0d0)) / (y + x)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.58e-158) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 3e+77) {
		tmp = x / ((y + x) * (y + (x + 1.0)));
	} else {
		tmp = (x / (y + 1.0)) / (y + x);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.58e-158:
		tmp = (y / x) / (x + 1.0)
	elif y <= 3e+77:
		tmp = x / ((y + x) * (y + (x + 1.0)))
	else:
		tmp = (x / (y + 1.0)) / (y + x)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.58e-158)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	elseif (y <= 3e+77)
		tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))));
	else
		tmp = Float64(Float64(x / Float64(y + 1.0)) / Float64(y + x));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.58e-158)
		tmp = (y / x) / (x + 1.0);
	elseif (y <= 3e+77)
		tmp = x / ((y + x) * (y + (x + 1.0)));
	else
		tmp = (x / (y + 1.0)) / (y + x);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.58e-158], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3e+77], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{elif}\;y \leq 3 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.57999999999999994e-158

    1. Initial program 62.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative62.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*62.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac93.0%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative93.0%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr93.0%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/93.0%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in y around 0 51.7%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    8. Step-by-step derivation
      1. associate-/r*54.1%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
    9. Simplified54.1%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]

    if 1.57999999999999994e-158 < y < 2.9999999999999998e77

    1. Initial program 77.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. *-commutative77.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*76.9%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac99.7%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative99.7%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+99.7%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr99.7%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in y around inf 70.7%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]

    if 2.9999999999999998e77 < y

    1. Initial program 62.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. *-commutative62.0%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*62.0%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac90.3%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative90.3%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative90.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+90.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative90.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+90.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr90.3%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/90.4%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in x around 0 78.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{1 + y}}}{x + y} \]
    8. Step-by-step derivation
      1. +-commutative78.8%

        \[\leadsto \frac{\frac{x}{\color{blue}{y + 1}}}{x + y} \]
    9. Simplified78.8%

      \[\leadsto \frac{\color{blue}{\frac{x}{y + 1}}}{x + y} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 3 \cdot 10^{+77}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + 1}}{y + x}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 86.9% accurate, 0.8× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 1.58e-158)
   (/ (/ y x) (+ x 1.0))
   (if (<= y 1.8e+132)
     (/ x (* (+ y x) (+ y (+ x 1.0))))
     (/ (/ x (+ y x)) (+ (+ y x) 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.58e-158) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 1.8e+132) {
		tmp = x / ((y + x) * (y + (x + 1.0)));
	} else {
		tmp = (x / (y + x)) / ((y + x) + 1.0);
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 1.58d-158) then
        tmp = (y / x) / (x + 1.0d0)
    else if (y <= 1.8d+132) then
        tmp = x / ((y + x) * (y + (x + 1.0d0)))
    else
        tmp = (x / (y + x)) / ((y + x) + 1.0d0)
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.58e-158) {
		tmp = (y / x) / (x + 1.0);
	} else if (y <= 1.8e+132) {
		tmp = x / ((y + x) * (y + (x + 1.0)));
	} else {
		tmp = (x / (y + x)) / ((y + x) + 1.0);
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.58e-158:
		tmp = (y / x) / (x + 1.0)
	elif y <= 1.8e+132:
		tmp = x / ((y + x) * (y + (x + 1.0)))
	else:
		tmp = (x / (y + x)) / ((y + x) + 1.0)
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.58e-158)
		tmp = Float64(Float64(y / x) / Float64(x + 1.0));
	elseif (y <= 1.8e+132)
		tmp = Float64(x / Float64(Float64(y + x) * Float64(y + Float64(x + 1.0))));
	else
		tmp = Float64(Float64(x / Float64(y + x)) / Float64(Float64(y + x) + 1.0));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 1.58e-158)
		tmp = (y / x) / (x + 1.0);
	elseif (y <= 1.8e+132)
		tmp = x / ((y + x) * (y + (x + 1.0)));
	else
		tmp = (x / (y + x)) / ((y + x) + 1.0);
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 1.58e-158], N[(N[(y / x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.8e+132], N[(x / N[(N[(y + x), $MachinePrecision] * N[(y + N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / N[(y + x), $MachinePrecision]), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\
\;\;\;\;\frac{\frac{y}{x}}{x + 1}\\

\mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\
\;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if y < 1.57999999999999994e-158

    1. Initial program 62.7%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative62.7%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*62.7%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac93.0%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative93.0%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+93.0%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr93.0%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/93.0%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in y around 0 51.7%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    8. Step-by-step derivation
      1. associate-/r*54.1%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
    9. Simplified54.1%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]

    if 1.57999999999999994e-158 < y < 1.80000000000000008e132

    1. Initial program 70.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. *-commutative70.2%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*70.1%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac98.2%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative98.2%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative98.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+98.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative98.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+98.2%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr98.2%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in y around inf 69.5%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]

    if 1.80000000000000008e132 < y

    1. Initial program 68.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative68.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*68.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac88.8%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative88.8%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative88.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+88.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative88.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+88.8%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr88.8%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in y around inf 88.8%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
    6. Step-by-step derivation
      1. add-exp-log85.1%

        \[\leadsto 1 \cdot \color{blue}{e^{\log \left(\frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}\right)}} \]
      2. associate-/r*84.4%

        \[\leadsto 1 \cdot e^{\log \color{blue}{\left(\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}\right)}} \]
      3. +-commutative84.4%

        \[\leadsto 1 \cdot e^{\log \left(\frac{\frac{x}{y + x}}{y + \color{blue}{\left(x + 1\right)}}\right)} \]
      4. log-div75.0%

        \[\leadsto 1 \cdot e^{\color{blue}{\log \left(\frac{x}{y + x}\right) - \log \left(y + \left(x + 1\right)\right)}} \]
      5. +-commutative75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{\color{blue}{x + y}}\right) - \log \left(y + \left(x + 1\right)\right)} \]
      6. associate-+r+75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \log \color{blue}{\left(\left(y + x\right) + 1\right)}} \]
      7. +-commutative75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \log \color{blue}{\left(1 + \left(y + x\right)\right)}} \]
      8. log1p-define75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \color{blue}{\mathsf{log1p}\left(y + x\right)}} \]
      9. +-commutative75.0%

        \[\leadsto 1 \cdot e^{\log \left(\frac{x}{x + y}\right) - \mathsf{log1p}\left(\color{blue}{x + y}\right)} \]
    7. Applied egg-rr75.0%

      \[\leadsto 1 \cdot \color{blue}{e^{\log \left(\frac{x}{x + y}\right) - \mathsf{log1p}\left(x + y\right)}} \]
    8. Step-by-step derivation
      1. exp-diff74.9%

        \[\leadsto 1 \cdot \color{blue}{\frac{e^{\log \left(\frac{x}{x + y}\right)}}{e^{\mathsf{log1p}\left(x + y\right)}}} \]
      2. rem-exp-log90.1%

        \[\leadsto 1 \cdot \frac{\color{blue}{\frac{x}{x + y}}}{e^{\mathsf{log1p}\left(x + y\right)}} \]
      3. log1p-undefine90.1%

        \[\leadsto 1 \cdot \frac{\frac{x}{x + y}}{e^{\color{blue}{\log \left(1 + \left(x + y\right)\right)}}} \]
      4. rem-exp-log91.7%

        \[\leadsto 1 \cdot \frac{\frac{x}{x + y}}{\color{blue}{1 + \left(x + y\right)}} \]
    9. Simplified91.7%

      \[\leadsto 1 \cdot \color{blue}{\frac{\frac{x}{x + y}}{1 + \left(x + y\right)}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.58 \cdot 10^{-158}:\\ \;\;\;\;\frac{\frac{y}{x}}{x + 1}\\ \mathbf{elif}\;y \leq 1.8 \cdot 10^{+132}:\\ \;\;\;\;\frac{x}{\left(y + x\right) \cdot \left(y + \left(x + 1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{y + x}}{\left(y + x\right) + 1}\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 66.4% accurate, 1.4× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 8.2 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y)
 :precision binary64
 (if (<= y 8.2e-162) (/ y (+ y x)) (/ x (* y (+ y 1.0)))))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 8.2e-162) {
		tmp = y / (y + x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (y <= 8.2d-162) then
        tmp = y / (y + x)
    else
        tmp = x / (y * (y + 1.0d0))
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 8.2e-162) {
		tmp = y / (y + x);
	} else {
		tmp = x / (y * (y + 1.0));
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 8.2e-162:
		tmp = y / (y + x)
	else:
		tmp = x / (y * (y + 1.0))
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 8.2e-162)
		tmp = Float64(y / Float64(y + x));
	else
		tmp = Float64(x / Float64(y * Float64(y + 1.0)));
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (y <= 8.2e-162)
		tmp = y / (y + x);
	else
		tmp = x / (y * (y + 1.0));
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[y, 8.2e-162], N[(y / N[(y + 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}\;y \leq 8.2 \cdot 10^{-162}:\\
\;\;\;\;\frac{y}{y + x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 8.20000000000000039e-162

    1. Initial program 62.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. *-commutative62.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*62.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac92.9%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative92.9%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative92.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+92.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative92.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+92.9%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr92.9%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/92.9%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in y around 0 54.5%

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{x + y} \]
    8. Taylor expanded in x around 0 30.0%

      \[\leadsto \frac{\color{blue}{y}}{x + y} \]

    if 8.20000000000000039e-162 < y

    1. Initial program 69.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*80.7%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+80.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. Simplified80.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 61.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification42.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 8.2 \cdot 10^{-162}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot \left(y + 1\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 35.7% accurate, 1.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-226}:\\ \;\;\;\;\frac{y}{x} - y\\ \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 (<= y 1.9e-226) (- (/ y x) y) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (y <= 1.9e-226) {
		tmp = (y / x) - y;
	} 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 (y <= 1.9d-226) then
        tmp = (y / x) - y
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (y <= 1.9e-226) {
		tmp = (y / x) - y;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if y <= 1.9e-226:
		tmp = (y / x) - y
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (y <= 1.9e-226)
		tmp = Float64(Float64(y / x) - y);
	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 (y <= 1.9e-226)
		tmp = (y / x) - y;
	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[y, 1.9e-226], N[(N[(y / x), $MachinePrecision] - y), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.9 \cdot 10^{-226}:\\
\;\;\;\;\frac{y}{x} - y\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < 1.89999999999999991e-226

    1. Initial program 61.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. *-commutative61.8%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*61.8%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac92.1%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative92.1%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative92.1%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+92.1%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative92.1%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+92.1%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr92.1%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/92.1%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in y around 0 48.5%

      \[\leadsto \color{blue}{\frac{y}{x \cdot \left(1 + x\right)}} \]
    8. Step-by-step derivation
      1. associate-/r*51.2%

        \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
    9. Simplified51.2%

      \[\leadsto \color{blue}{\frac{\frac{y}{x}}{1 + x}} \]
    10. Taylor expanded in x around 0 12.7%

      \[\leadsto \color{blue}{-1 \cdot y + \frac{y}{x}} \]
    11. Step-by-step derivation
      1. +-commutative12.7%

        \[\leadsto \color{blue}{\frac{y}{x} + -1 \cdot y} \]
      2. neg-mul-112.7%

        \[\leadsto \frac{y}{x} + \color{blue}{\left(-y\right)} \]
      3. unsub-neg12.7%

        \[\leadsto \color{blue}{\frac{y}{x} - y} \]
    12. Simplified12.7%

      \[\leadsto \color{blue}{\frac{y}{x} - y} \]

    if 1.89999999999999991e-226 < y

    1. Initial program 69.8%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*80.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+80.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. Simplified80.6%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 56.4%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around 0 32.5%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification21.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq 1.9 \cdot 10^{-226}:\\ \;\;\;\;\frac{y}{x} - y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 45.2% accurate, 1.7× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-181}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \end{array} \]
NOTE: x and y should be sorted in increasing order before calling this function.
(FPCore (x y) :precision binary64 (if (<= x -4e-181) (/ y (+ y x)) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -4e-181) {
		tmp = y / (y + x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-4d-181)) then
        tmp = y / (y + x)
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -4e-181) {
		tmp = y / (y + x);
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -4e-181:
		tmp = y / (y + x)
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -4e-181)
		tmp = Float64(y / Float64(y + x));
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -4e-181)
		tmp = y / (y + x);
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -4e-181], N[(y / N[(y + x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4 \cdot 10^{-181}:\\
\;\;\;\;\frac{y}{y + x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -4.00000000000000019e-181

    1. Initial program 69.3%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative69.3%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*69.3%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac93.3%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative93.3%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative93.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+93.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative93.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+93.3%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr93.3%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Step-by-step derivation
      1. associate-*l/93.3%

        \[\leadsto \color{blue}{\frac{y \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}}{y + x}} \]
      2. associate-/r*99.8%

        \[\leadsto \frac{y \cdot \color{blue}{\frac{\frac{x}{y + x}}{y + \left(1 + x\right)}}}{y + x} \]
      3. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{\color{blue}{x + y}}}{y + \left(1 + x\right)}}{y + x} \]
      4. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{y + \color{blue}{\left(x + 1\right)}}}{y + x} \]
      5. associate-+r+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(y + x\right) + 1}}}{y + x} \]
      6. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{\left(x + y\right)} + 1}}{y + x} \]
      7. associate-+l+99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{\color{blue}{x + \left(y + 1\right)}}}{y + x} \]
      8. +-commutative99.8%

        \[\leadsto \frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{\color{blue}{x + y}} \]
    6. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{y \cdot \frac{\frac{x}{x + y}}{x + \left(y + 1\right)}}{x + y}} \]
    7. Taylor expanded in y around 0 62.0%

      \[\leadsto \frac{\color{blue}{\frac{y}{1 + x}}}{x + y} \]
    8. Taylor expanded in x around 0 27.6%

      \[\leadsto \frac{\color{blue}{y}}{x + y} \]

    if -4.00000000000000019e-181 < x

    1. Initial program 63.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*76.1%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+76.1%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified76.1%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 59.0%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around 0 38.0%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification34.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -4 \cdot 10^{-181}:\\ \;\;\;\;\frac{y}{y + x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 28.7% accurate, 2.1× speedup?

\[\begin{array}{l} [x, y] = \mathsf{sort}([x, y])\\ \\ \begin{array}{l} \mathbf{if}\;x \leq -0.002:\\ \;\;\;\;\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 -0.002) (/ 1.0 x) (/ x y)))
assert(x < y);
double code(double x, double y) {
	double tmp;
	if (x <= -0.002) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
NOTE: x and y should be sorted in increasing order before calling this function.
real(8) function code(x, y)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8) :: tmp
    if (x <= (-0.002d0)) then
        tmp = 1.0d0 / x
    else
        tmp = x / y
    end if
    code = tmp
end function
assert x < y;
public static double code(double x, double y) {
	double tmp;
	if (x <= -0.002) {
		tmp = 1.0 / x;
	} else {
		tmp = x / y;
	}
	return tmp;
}
[x, y] = sort([x, y])
def code(x, y):
	tmp = 0
	if x <= -0.002:
		tmp = 1.0 / x
	else:
		tmp = x / y
	return tmp
x, y = sort([x, y])
function code(x, y)
	tmp = 0.0
	if (x <= -0.002)
		tmp = Float64(1.0 / x);
	else
		tmp = Float64(x / y);
	end
	return tmp
end
x, y = num2cell(sort([x, y])){:}
function tmp_2 = code(x, y)
	tmp = 0.0;
	if (x <= -0.002)
		tmp = 1.0 / x;
	else
		tmp = x / y;
	end
	tmp_2 = tmp;
end
NOTE: x and y should be sorted in increasing order before calling this function.
code[x_, y_] := If[LessEqual[x, -0.002], N[(1.0 / x), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
[x, y] = \mathsf{sort}([x, y])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.002:\\
\;\;\;\;\frac{1}{x}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -2e-3

    1. Initial program 58.9%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. *-commutative58.9%

        \[\leadsto \frac{\color{blue}{y \cdot x}}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      2. associate-*l*58.9%

        \[\leadsto \frac{y \cdot x}{\color{blue}{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)\right)}} \]
      3. times-frac89.6%

        \[\leadsto \color{blue}{\frac{y}{x + y} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      4. +-commutative89.6%

        \[\leadsto \frac{y}{\color{blue}{y + x}} \cdot \frac{x}{\left(x + y\right) \cdot \left(\left(x + y\right) + 1\right)} \]
      5. +-commutative89.6%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\color{blue}{\left(y + x\right)} \cdot \left(\left(x + y\right) + 1\right)} \]
      6. associate-+r+89.6%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
      7. +-commutative89.6%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(\left(y + 1\right) + x\right)}} \]
      8. associate-+l+89.6%

        \[\leadsto \frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \color{blue}{\left(y + \left(1 + x\right)\right)}} \]
    4. Applied egg-rr89.6%

      \[\leadsto \color{blue}{\frac{y}{y + x} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)}} \]
    5. Taylor expanded in y around inf 52.8%

      \[\leadsto \color{blue}{1} \cdot \frac{x}{\left(y + x\right) \cdot \left(y + \left(1 + x\right)\right)} \]
    6. Taylor expanded in x around inf 6.6%

      \[\leadsto 1 \cdot \color{blue}{\frac{1}{x}} \]

    if -2e-3 < x

    1. Initial program 67.4%

      \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
    2. Step-by-step derivation
      1. associate-/l*79.5%

        \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)}} \]
      2. associate-+l+79.5%

        \[\leadsto x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \color{blue}{\left(x + \left(y + 1\right)\right)}} \]
    3. Simplified79.5%

      \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
    4. Add Preprocessing
    5. Taylor expanded in x around 0 62.3%

      \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
    6. Taylor expanded in y around 0 37.8%

      \[\leadsto \color{blue}{\frac{x}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification30.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -0.002:\\ \;\;\;\;\frac{1}{x}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 27.2% 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 65.4%

    \[\frac{x \cdot y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(\left(x + y\right) + 1\right)} \]
  2. Step-by-step derivation
    1. associate-/l*78.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+78.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. Simplified78.2%

    \[\leadsto \color{blue}{x \cdot \frac{y}{\left(\left(x + y\right) \cdot \left(x + y\right)\right) \cdot \left(x + \left(y + 1\right)\right)}} \]
  4. Add Preprocessing
  5. Taylor expanded in x around 0 52.2%

    \[\leadsto \color{blue}{\frac{x}{y \cdot \left(1 + y\right)}} \]
  6. Taylor expanded in y around 0 29.6%

    \[\leadsto \color{blue}{\frac{x}{y}} \]
  7. Final simplification29.6%

    \[\leadsto \frac{x}{y} \]
  8. 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 2024039 
(FPCore (x y)
  :name "Numeric.SpecFunctions:incompleteBetaApprox from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (/ (/ (/ x (+ (+ y 1.0) x)) (+ y x)) (/ 1.0 (/ y (+ y x))))

  (/ (* x y) (* (* (+ x y) (+ x y)) (+ (+ x y) 1.0))))